@routier/core 0.2.0 → 0.3.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/LICENSE +21 -0
- package/{readme.md → README.md} +2 -2
- package/dist/assertions/index.cjs +191 -0
- package/dist/assertions/index.cjs.map +1 -0
- package/dist/assertions/index.d.ts +30 -0
- package/dist/assertions/index.js +94 -30
- package/dist/assertions/index.js.map +1 -1
- package/dist/capabilities/index.cjs +820 -0
- package/dist/capabilities/index.cjs.map +1 -0
- package/dist/capabilities/index.js +580 -545
- package/dist/capabilities/index.js.map +1 -1
- package/dist/codegen/handlers/CloneHandlerBuilder.d.ts +10 -1
- package/dist/codegen/handlers/SetHandlerBuilder.d.ts +4 -0
- package/dist/codegen/handlers/clone/CloneArrayHandler.d.ts +3 -0
- package/dist/codegen/handlers/clone/CloneDateHandler.d.ts +13 -0
- package/dist/codegen/handlers/clone/CloneValueHandler.d.ts +16 -0
- package/dist/codegen/handlers/compare/CompareComputedHandler.d.ts +10 -0
- package/dist/codegen/handlers/compare/CompareFunctionHandler.d.ts +10 -0
- package/dist/codegen/handlers/deserialize/DeserializeArrayHandler.d.ts +14 -0
- package/dist/codegen/handlers/enableChangeTracking/EnableChangeTrackingArrayHandler.d.ts +11 -0
- package/dist/codegen/handlers/enrichment/EnrichmentArrayHandler.d.ts +11 -0
- package/dist/codegen/handlers/freeze/FreezeArrayHandler.d.ts +6 -0
- package/dist/codegen/handlers/hash/HashArrayHandler.d.ts +10 -0
- package/dist/codegen/handlers/hash/HashFileHandler.d.ts +24 -0
- package/dist/codegen/handlers/hash/HashObjectHandler.d.ts +10 -0
- package/dist/codegen/handlers/hash/HashTransformHandler.d.ts +23 -0
- package/dist/codegen/handlers/index.d.ts +1 -0
- package/dist/codegen/handlers/merge/MergeArrayHandler.d.ts +20 -0
- package/dist/codegen/handlers/merge/MergeObjectHandler.d.ts +10 -0
- package/dist/codegen/handlers/serialize/SerializeArrayHandler.d.ts +19 -0
- package/dist/codegen/handlers/serialize/SerializeComputedHandler.d.ts +6 -0
- package/dist/codegen/handlers/set/SetComplexHandler.d.ts +6 -0
- package/dist/codegen/handlers/strip/StripComputedHandler.d.ts +10 -0
- package/dist/codegen/handlers/strip/StripFunctionHandler.d.ts +9 -0
- package/dist/codegen/handlers/types.d.ts +55 -1
- package/dist/codegen/index.cjs +618 -0
- package/dist/codegen/index.cjs.map +1 -0
- package/dist/codegen/index.js +100 -127
- package/dist/codegen/index.js.map +1 -1
- package/dist/collections/Changes.d.ts +2 -2
- package/dist/collections/MemoryDataCollection.d.ts +15 -1
- package/dist/collections/TagCollection.d.ts +7 -8
- package/dist/collections/index.cjs +702 -0
- package/dist/collections/index.cjs.map +1 -0
- package/dist/collections/index.js +282 -276
- package/dist/collections/index.js.map +1 -1
- package/dist/errors/OptimisticConcurrencyError.d.ts +18 -0
- package/dist/errors/PluginDestroyedError.d.ts +10 -0
- package/dist/errors/index.cjs +132 -0
- package/dist/errors/index.cjs.map +1 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +61 -19
- package/dist/errors/index.js.map +1 -1
- package/dist/expressions/constants.d.ts +2 -0
- package/dist/expressions/evaluate.d.ts +53 -0
- package/dist/expressions/index.cjs +2087 -0
- package/dist/expressions/index.cjs.map +1 -0
- package/dist/expressions/index.d.ts +2 -0
- package/dist/expressions/index.js +1784 -772
- package/dist/expressions/index.js.map +1 -1
- package/dist/expressions/parser.d.ts +19 -0
- package/dist/expressions/types.d.ts +87 -2
- package/dist/expressions/utils.d.ts +1 -2
- package/dist/index.cjs +13925 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +12094 -7049
- package/dist/index.js.map +1 -1
- package/dist/performance/index.cjs +217 -0
- package/dist/performance/index.cjs.map +1 -0
- package/dist/performance/index.js +126 -50
- package/dist/performance/index.js.map +1 -1
- package/dist/pipeline/index.cjs +576 -0
- package/dist/pipeline/index.cjs.map +1 -0
- package/dist/pipeline/index.js +229 -156
- package/dist/pipeline/index.js.map +1 -1
- package/dist/plugins/BatchingDbPlugin.d.ts +139 -0
- package/dist/plugins/CacheDbPlugin.d.ts +70 -0
- package/dist/plugins/ConcurrencyDbPlugin.d.ts +78 -0
- package/dist/plugins/EphemeralDataPlugin.d.ts +57 -1
- package/dist/plugins/RetryDbPlugin.d.ts +77 -0
- package/dist/plugins/index.cjs +6104 -0
- package/dist/plugins/index.cjs.map +1 -0
- package/dist/plugins/index.d.ts +5 -1
- package/dist/plugins/index.js +5572 -1491
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/query/QueryOptionsCollection.d.ts +22 -0
- package/dist/plugins/query/index.d.ts +2 -0
- package/dist/plugins/query/join.d.ts +210 -0
- package/dist/plugins/query/similarity.d.ts +38 -0
- package/dist/plugins/query/types.d.ts +64 -1
- package/dist/plugins/translators/DataTranslator.d.ts +28 -0
- package/dist/plugins/translators/JsonTranslator.d.ts +27 -0
- package/dist/plugins/translators/SqlTranslator.d.ts +45 -0
- package/dist/plugins/translators/TranslatedArrayValue.d.ts +3 -1
- package/dist/plugins/translators/TranslatedGroupValue.d.ts +3 -1
- package/dist/plugins/translators/TranslatedSingleValue.d.ts +3 -1
- package/dist/plugins/translators/TupleTranslator.d.ts +45 -0
- package/dist/plugins/translators/index.d.ts +1 -0
- package/dist/plugins/translators/types.d.ts +8 -1
- package/dist/plugins/types.d.ts +87 -11
- package/dist/plugins/wire/handler.d.ts +122 -0
- package/dist/plugins/wire/index.d.ts +4 -0
- package/dist/plugins/wire/persist.d.ts +43 -0
- package/dist/plugins/wire/query.d.ts +49 -0
- package/dist/plugins/wire/types.d.ts +123 -0
- package/dist/results/Result.d.ts +2 -2
- package/dist/results/index.cjs +174 -0
- package/dist/results/index.cjs.map +1 -0
- package/dist/results/index.js +29 -44
- package/dist/results/index.js.map +1 -1
- package/dist/schema/PropertyInfo.d.ts +35 -2
- package/dist/schema/SchemaDefinition.d.ts +51 -1
- package/dist/schema/builder.d.ts +35 -1
- package/dist/schema/communication/broadcast.d.ts +17 -1
- package/dist/schema/index.cjs +6911 -0
- package/dist/schema/index.cjs.map +1 -0
- package/dist/schema/index.d.ts +4 -0
- package/dist/schema/index.js +5781 -3973
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/property/base/SchemaBase.d.ts +50 -2
- package/dist/schema/property/modifiers/SchemaDeserialize.d.ts +5 -1
- package/dist/schema/property/modifiers/SchemaForeignKey.d.ts +15 -0
- package/dist/schema/property/modifiers/SchemaKey.d.ts +2 -0
- package/dist/schema/property/modifiers/SchemaNullable.d.ts +15 -1
- package/dist/schema/property/modifiers/SchemaOptional.d.ts +22 -1
- package/dist/schema/property/modifiers/SchemaSearchable.d.ts +34 -0
- package/dist/schema/property/modifiers/SchemaTag.d.ts +27 -0
- package/dist/schema/property/modifiers/SchemaTracked.d.ts +5 -1
- package/dist/schema/property/modifiers/index.d.ts +3 -0
- package/dist/schema/property/types/SchemaArray.d.ts +2 -0
- package/dist/schema/property/types/SchemaBoolean.d.ts +2 -0
- package/dist/schema/property/types/SchemaDate.d.ts +2 -0
- package/dist/schema/property/types/SchemaFile.d.ts +60 -0
- package/dist/schema/property/types/SchemaNumber.d.ts +5 -1
- package/dist/schema/property/types/SchemaObject.d.ts +2 -0
- package/dist/schema/property/types/SchemaString.d.ts +25 -1
- package/dist/schema/property/types/SchemaVector.d.ts +61 -0
- package/dist/schema/property/types/index.d.ts +2 -0
- package/dist/schema/table/SchemaTransform.d.ts +40 -0
- package/dist/schema/table/index.d.ts +1 -0
- package/dist/schema/types.d.ts +200 -32
- package/dist/schema/utils/propertyKind.d.ts +4 -0
- package/dist/schema/utils/standardJsonSchema.d.ts +90 -0
- package/dist/types/index.cjs +23 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.js +0 -14
- package/dist/types/index.js.map +1 -1
- package/dist/utilities/functions.d.ts +1 -1
- package/dist/utilities/index.cjs +982 -0
- package/dist/utilities/index.cjs.map +1 -0
- package/dist/utilities/index.js +590 -321
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/logger.d.ts +48 -0
- package/package.json +152 -98
- package/dist/collections/Changes.test.d.ts +0 -1
- package/dist/collections/MemoryDataCollection.test.d.ts +0 -1
- package/dist/collections/TagCollection.test.d.ts +0 -1
- package/dist/expressions/parser.test.d.ts +0 -1
- package/dist/expressions/utils.test.d.ts +0 -1
- package/dist/pipeline/SyncronousQueue.test.d.ts +0 -1
- package/dist/pipeline/WorkPipeline.test.d.ts +0 -1
- package/dist/plugins/EphemeralDataPlugin.test.d.ts +0 -1
- package/dist/plugins/query/QueryOptionsCollection.test.d.ts +0 -1
- package/dist/plugins/replication/OptimisticReplicationDbPlugin.d.ts +0 -23
- package/dist/plugins/replication/ReplicationDbPlugin.d.ts +0 -22
- package/dist/plugins/replication/index.d.ts +0 -3
- package/dist/plugins/replication/types.d.ts +0 -5
- package/dist/plugins/translators/JsonTranslator.test.d.ts +0 -1
- package/dist/schema/PropertyInfo.test.d.ts +0 -1
- package/dist/schema/schemaGeneration.test.d.ts +0 -1
- package/dist/schema/testSchemas.test.d.ts +0 -314
- package/dist/utilities/arrays.test.d.ts +0 -1
- package/dist/utilities/dates.test.d.ts +0 -1
- package/dist/utilities/strings.test.d.ts +0 -1
|
@@ -1,9 +1,385 @@
|
|
|
1
1
|
var __webpack_modules__ = ({
|
|
2
|
-
|
|
3
|
-
__webpack_require__.r(__webpack_exports__);
|
|
2
|
+
581(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
4
3
|
__webpack_require__.d(__webpack_exports__, {
|
|
5
|
-
|
|
4
|
+
vF: () => (logger)
|
|
6
5
|
});
|
|
6
|
+
/**
|
|
7
|
+
* Levelled logging, resolved once.
|
|
8
|
+
*
|
|
9
|
+
* Three things about the previous implementation drove this shape:
|
|
10
|
+
*
|
|
11
|
+
* - **There was no way to turn logging off.** `globalThis.__ROUTIER_DEBUG__` was only ever
|
|
12
|
+
* compared against `true`, so setting it to `false` did nothing — while
|
|
13
|
+
* `docs/how-to/debug-logging.md` documented exactly that as the way to force logging off.
|
|
14
|
+
* A documented switch that silently does nothing is worse than no switch.
|
|
15
|
+
* - **`NODE_ENV === 'test'` enabled it.** Every Jest run therefore logged, because Jest always
|
|
16
|
+
* sets `NODE_ENV=test`. Measured on the S7 stress scenario, which drives ~2,000 saves through
|
|
17
|
+
* a plugin that logs three lines per query: 12.4s with logging, ~6s without. Test runners also
|
|
18
|
+
* capture console output by snapshotting a stack trace per call, so the cost is far above what
|
|
19
|
+
* writing to a terminal would suggest — and the output buries whatever the failure was.
|
|
20
|
+
* - **It was all-or-nothing, and re-resolved per call.** An error could not be kept while debug
|
|
21
|
+
* was dropped, and every one of the ~97 call sites re-read `globalThis` and `process.env`.
|
|
22
|
+
*
|
|
23
|
+
* Levels are compared numerically against a value cached at module load. Measured against a
|
|
24
|
+
* no-op console at 200k calls: an enabled call costs ~70ns, a call rejected by the gate ~3ns.
|
|
25
|
+
* Building the arguments the call site passes in accounts for ~0.2ns of that 3ns, which is why
|
|
26
|
+
* this keeps the ordinary `logger.debug(msg, payload)` signature instead of taking a thunk —
|
|
27
|
+
* a lazy API would recover 0.3% of an enabled call's cost and would have to change every call
|
|
28
|
+
* site to do it.
|
|
29
|
+
*/ /** Ordered from most severe to most verbose. `silent` discards everything. */ const LOG_LEVELS = [
|
|
30
|
+
'silent',
|
|
31
|
+
'error',
|
|
32
|
+
'warn',
|
|
33
|
+
'info',
|
|
34
|
+
'debug'
|
|
35
|
+
];
|
|
36
|
+
/** Numeric rank, so a gate is one integer comparison. */ const RANK = {
|
|
37
|
+
silent: 0,
|
|
38
|
+
error: 1,
|
|
39
|
+
warn: 2,
|
|
40
|
+
info: 3,
|
|
41
|
+
debug: 4
|
|
42
|
+
};
|
|
43
|
+
const isLogLevel = (value)=>typeof value === 'string' && LOG_LEVELS.includes(value);
|
|
44
|
+
/**
|
|
45
|
+
* Resolves the configured level, in precedence order.
|
|
46
|
+
*
|
|
47
|
+
* Ordered most specific first: an explicit level beats a boolean flag, a boolean flag beats an
|
|
48
|
+
* environment variable, and an environment variable beats an inference from `NODE_ENV`. Anything
|
|
49
|
+
* unrecognised is ignored rather than treated as an error — a typo'd level should not take down
|
|
50
|
+
* an application, and `silent` is the safe direction to fall back to.
|
|
51
|
+
*/ const resolveLevel = ()=>{
|
|
52
|
+
if (typeof globalThis !== 'undefined') {
|
|
53
|
+
const g = globalThis;
|
|
54
|
+
if (isLogLevel(g.__ROUTIER_LOG_LEVEL__)) {
|
|
55
|
+
return g.__ROUTIER_LOG_LEVEL__;
|
|
56
|
+
}
|
|
57
|
+
// Both directions honoured. `=== false` used to fall through to the NODE_ENV checks
|
|
58
|
+
// below and re-enable the logging it was asked to suppress.
|
|
59
|
+
if (g.__ROUTIER_DEBUG__ === true) return 'debug';
|
|
60
|
+
if (g.__ROUTIER_DEBUG__ === false) return 'silent';
|
|
61
|
+
}
|
|
62
|
+
// There is deliberately no `import.meta.env` branch, although the documentation used to
|
|
63
|
+
// promise one. It could never work: this package is bundled with rspack, which replaces
|
|
64
|
+
// `import.meta` with `undefined`, so the check would read the *library's* build-time
|
|
65
|
+
// environment rather than the application's — and referencing `import.meta` at all is a parse
|
|
66
|
+
// error under a CommonJS build target, which is how the test suite loads this file. Vite and
|
|
67
|
+
// similar apps set `__ROUTIER_LOG_LEVEL__` or `__ROUTIER_DEBUG__` from their own
|
|
68
|
+
// `import.meta.env`, which is what the docs now describe.
|
|
69
|
+
if (typeof process !== 'undefined' && process.env != null) {
|
|
70
|
+
if (isLogLevel(process.env.ROUTIER_LOG_LEVEL)) {
|
|
71
|
+
return process.env.ROUTIER_LOG_LEVEL;
|
|
72
|
+
}
|
|
73
|
+
const debug = process.env.DEBUG;
|
|
74
|
+
if (debug === 'routier' || debug === '*') return 'debug';
|
|
75
|
+
const env = "production"?.toLowerCase();
|
|
76
|
+
// `test` is deliberately absent. It used to be here, which meant no test suite anywhere
|
|
77
|
+
// could run Routier quietly. Opt in with DEBUG=routier or ROUTIER_LOG_LEVEL when a test
|
|
78
|
+
// needs the output.
|
|
79
|
+
if (env === 'dev' || env === 'development') return 'debug';
|
|
80
|
+
}
|
|
81
|
+
return 'silent';
|
|
82
|
+
};
|
|
83
|
+
let level = resolveLevel();
|
|
84
|
+
let rank = RANK[level];
|
|
85
|
+
/**
|
|
86
|
+
* Overrides the level for the rest of the process.
|
|
87
|
+
*
|
|
88
|
+
* The configuration above is read once, at import, which is what makes the gate cheap — but it
|
|
89
|
+
* also means an application that decides its verbosity after startup, or a test that wants to
|
|
90
|
+
* assert on output, has no way in. This is that way in.
|
|
91
|
+
*/ const setLogLevel = (next)=>{
|
|
92
|
+
if (isLogLevel(next) === false) {
|
|
93
|
+
throw new Error(`Unknown log level "${next}". Expected one of: ${LOG_LEVELS.join(', ')}`);
|
|
94
|
+
}
|
|
95
|
+
level = next;
|
|
96
|
+
rank = RANK[next];
|
|
97
|
+
};
|
|
98
|
+
const getLogLevel = ()=>level;
|
|
99
|
+
/** Re-reads the environment. For tests that change it after this module was imported. */ const resetLogLevel = ()=>{
|
|
100
|
+
level = resolveLevel();
|
|
101
|
+
rank = RANK[level];
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Whether a message at this level would be emitted.
|
|
105
|
+
*
|
|
106
|
+
* For the rare call site whose *arguments* are expensive to build — a serialization, a deep
|
|
107
|
+
* clone, a join over a large collection. An ordinary payload object is not worth guarding; see
|
|
108
|
+
* the measurement in the header.
|
|
109
|
+
*/ const isLogLevelEnabled = (at)=>rank >= RANK[at];
|
|
110
|
+
const emit = (at, method, args)=>{
|
|
111
|
+
if (rank < RANK[at]) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
// Resolved at call time rather than captured once: test harnesses and browser devtools both
|
|
115
|
+
// replace console methods after modules have loaded, and a captured reference would keep
|
|
116
|
+
// writing past the replacement.
|
|
117
|
+
console[method](...args);
|
|
118
|
+
};
|
|
119
|
+
const logger = {
|
|
120
|
+
/** General-purpose output. Carried at `info`, since `log` names a console method, not a level. */ log: (...args)=>emit('info', 'log', args),
|
|
121
|
+
info: (...args)=>emit('info', 'info', args),
|
|
122
|
+
warn: (...args)=>emit('warn', 'warn', args),
|
|
123
|
+
error: (...args)=>emit('error', 'error', args),
|
|
124
|
+
debug: (...args)=>emit('debug', 'debug', args),
|
|
125
|
+
/** Diagnostic tabular output; verbose by nature, so it sits at `debug`. */ table: (...args)=>emit('debug', 'table', args)
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
},
|
|
130
|
+
615(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
131
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
132
|
+
Zm: () => (stringifyObject)
|
|
133
|
+
});
|
|
134
|
+
const hash = (value, seed = 0)=>{
|
|
135
|
+
// From Stack Overflow
|
|
136
|
+
// https://stackoverflow.com/a/52171480/3329760
|
|
137
|
+
let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
|
|
138
|
+
for(let i = 0, ch; i < value.length; i++){
|
|
139
|
+
ch = value.charCodeAt(i);
|
|
140
|
+
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
141
|
+
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
142
|
+
}
|
|
143
|
+
h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507);
|
|
144
|
+
h1 ^= Math.imul(h2 ^ h2 >>> 13, 3266489909);
|
|
145
|
+
h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507);
|
|
146
|
+
h2 ^= Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
147
|
+
return 4294967296 * (2097151 & h2) + (h1 >>> 0);
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Fast string hash optimized for comparisons.
|
|
151
|
+
* Uses djb2 algorithm - very fast and good distribution for short to medium strings.
|
|
152
|
+
* Same input always produces same output (deterministic).
|
|
153
|
+
*
|
|
154
|
+
* @param value - The string to hash
|
|
155
|
+
* @param seed - Optional seed value (default: 5381)
|
|
156
|
+
* @returns A positive 32-bit integer hash value
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```ts
|
|
160
|
+
* fastHash("test") === fastHash("test") // true
|
|
161
|
+
* fastHash("test") !== fastHash("test2") // true
|
|
162
|
+
* ```
|
|
163
|
+
*/ const fastHash = (value, seed = 5381)=>{
|
|
164
|
+
let hash = seed;
|
|
165
|
+
for(let i = 0; i < value.length; i++){
|
|
166
|
+
hash = (hash << 5) + hash + value.charCodeAt(i);
|
|
167
|
+
}
|
|
168
|
+
return hash >>> 0; // Convert to unsigned 32-bit integer
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Converts any value to a readable string representation.
|
|
172
|
+
* Handles primitives, objects, arrays, classes, dates, errors, and functions.
|
|
173
|
+
* Supports depth limiting to prevent infinite recursion on circular references.
|
|
174
|
+
*
|
|
175
|
+
* @param obj - The value to stringify
|
|
176
|
+
* @param maxDepth - Maximum depth for nested objects (default: 3)
|
|
177
|
+
* @param currentDepth - Current recursion depth (default: 0)
|
|
178
|
+
* @returns String representation of the value
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```ts
|
|
182
|
+
* stringifyObject({ name: "test", count: 5 }) // '{ name: "test", count: 5 }'
|
|
183
|
+
* stringifyObject([1, 2, 3]) // '[1, 2, 3]'
|
|
184
|
+
* stringifyObject(new Date()) // 'Date(2024-01-01T00:00:00.000Z)'
|
|
185
|
+
* ```
|
|
186
|
+
*/ function stringifyObject(obj, maxDepth = 3, currentDepth = 0) {
|
|
187
|
+
if (obj === null) return 'null';
|
|
188
|
+
if (obj === undefined) return 'undefined';
|
|
189
|
+
const type = typeof obj;
|
|
190
|
+
switch(type){
|
|
191
|
+
case 'string':
|
|
192
|
+
return `"${obj}"`;
|
|
193
|
+
case 'number':
|
|
194
|
+
case 'boolean':
|
|
195
|
+
return String(obj);
|
|
196
|
+
case 'function':
|
|
197
|
+
return `[Function: ${getFunctionName(obj)}]`;
|
|
198
|
+
case 'object':
|
|
199
|
+
if (currentDepth >= maxDepth) {
|
|
200
|
+
return '[Max Depth Reached]';
|
|
201
|
+
}
|
|
202
|
+
return stringifyObjectValue(obj, maxDepth, currentDepth);
|
|
203
|
+
default:
|
|
204
|
+
return `[${type}]`;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function getFunctionName(fn) {
|
|
208
|
+
const name = fn.name;
|
|
209
|
+
return name || 'anonymous';
|
|
210
|
+
}
|
|
211
|
+
function getObjectProperties(obj) {
|
|
212
|
+
const properties = {};
|
|
213
|
+
for(const key in obj){
|
|
214
|
+
if (obj.hasOwnProperty(key)) {
|
|
215
|
+
properties[key] = obj[key];
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return properties;
|
|
219
|
+
}
|
|
220
|
+
function stringifyObjectValue(obj, maxDepth, currentDepth) {
|
|
221
|
+
if (obj === null) return 'null';
|
|
222
|
+
if (obj instanceof Date) {
|
|
223
|
+
return `Date(${obj.toISOString()})`;
|
|
224
|
+
}
|
|
225
|
+
if (obj instanceof Error) {
|
|
226
|
+
return `Error(${obj.message})`;
|
|
227
|
+
}
|
|
228
|
+
if (obj instanceof RegExp) {
|
|
229
|
+
return obj.toString();
|
|
230
|
+
}
|
|
231
|
+
if (Array.isArray(obj)) {
|
|
232
|
+
return stringifyArray(obj, maxDepth, currentDepth);
|
|
233
|
+
}
|
|
234
|
+
if (obj.constructor && obj.constructor.name !== 'Object') {
|
|
235
|
+
return stringifyClassInstance(obj, maxDepth, currentDepth);
|
|
236
|
+
}
|
|
237
|
+
return stringifyPlainObject(obj, maxDepth, currentDepth);
|
|
238
|
+
}
|
|
239
|
+
function stringifyArray(arr, maxDepth, currentDepth) {
|
|
240
|
+
if (arr.length === 0) return '[]';
|
|
241
|
+
const items = arr.slice(0, 5).map((item)=>stringifyObject(item, maxDepth, currentDepth + 1));
|
|
242
|
+
const suffix = arr.length > 5 ? `... (+${arr.length - 5} more)` : '';
|
|
243
|
+
return `[${items.join(', ')}${suffix}]`;
|
|
244
|
+
}
|
|
245
|
+
function stringifyClassInstance(obj, maxDepth, currentDepth) {
|
|
246
|
+
const className = obj.constructor.name;
|
|
247
|
+
const properties = getObjectProperties(obj);
|
|
248
|
+
if (Object.keys(properties).length === 0) {
|
|
249
|
+
return `${className} {}`;
|
|
250
|
+
}
|
|
251
|
+
const props = Object.entries(properties).slice(0, 5).map(([key, value])=>{
|
|
252
|
+
const isPrimitive = value === null || value === undefined || typeof value !== 'object' && typeof value !== 'function';
|
|
253
|
+
const depth = isPrimitive ? currentDepth : currentDepth + 1;
|
|
254
|
+
return `${key}: ${stringifyObject(value, maxDepth, depth)}`;
|
|
255
|
+
});
|
|
256
|
+
const suffix = Object.keys(properties).length > 5 ? `... (+${Object.keys(properties).length - 5} more)` : '';
|
|
257
|
+
return `${className} { ${props.join(', ')}${suffix} }`;
|
|
258
|
+
}
|
|
259
|
+
function stringifyPlainObject(obj, maxDepth, currentDepth) {
|
|
260
|
+
const properties = getObjectProperties(obj);
|
|
261
|
+
if (Object.keys(properties).length === 0) {
|
|
262
|
+
return '{}';
|
|
263
|
+
}
|
|
264
|
+
const props = Object.entries(properties).slice(0, 5).map(([key, value])=>{
|
|
265
|
+
const isPrimitive = value === null || value === undefined || typeof value !== 'object' && typeof value !== 'function';
|
|
266
|
+
const depth = isPrimitive ? currentDepth : currentDepth + 1;
|
|
267
|
+
return `${key}: ${stringifyObject(value, maxDepth, depth)}`;
|
|
268
|
+
});
|
|
269
|
+
const suffix = Object.keys(properties).length > 5 ? `... (+${Object.keys(properties).length - 5} more)` : '';
|
|
270
|
+
return `{ ${props.join(', ')}${suffix} }`;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
},
|
|
275
|
+
618(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
276
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
277
|
+
u: () => (uuid)
|
|
278
|
+
});
|
|
279
|
+
const uuid = (length = 16)=>{
|
|
280
|
+
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
281
|
+
const charLength = chars.length;
|
|
282
|
+
let result = '';
|
|
283
|
+
for(let i = 0; i < length; i++){
|
|
284
|
+
result += chars[Math.random() * charLength | 0];
|
|
285
|
+
}
|
|
286
|
+
return result;
|
|
287
|
+
};
|
|
288
|
+
const HEX_CHARS = '0123456789abcdef';
|
|
289
|
+
const UUID_TEMPLATE = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
|
|
290
|
+
const hasCrypto = typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function';
|
|
291
|
+
const hasRandomUUID = typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function';
|
|
292
|
+
const uuidv4 = ()=>{
|
|
293
|
+
if (hasRandomUUID) {
|
|
294
|
+
return crypto.randomUUID();
|
|
295
|
+
}
|
|
296
|
+
return uuidv4Fallback();
|
|
297
|
+
};
|
|
298
|
+
const uuidv4Fallback = ()=>{
|
|
299
|
+
let randomBytes = null;
|
|
300
|
+
if (hasCrypto) {
|
|
301
|
+
randomBytes = crypto.getRandomValues(new Uint8Array(16));
|
|
302
|
+
}
|
|
303
|
+
let byteIndex = 0;
|
|
304
|
+
let uuid = '';
|
|
305
|
+
for(let i = 0; i < UUID_TEMPLATE.length; i++){
|
|
306
|
+
const c = UUID_TEMPLATE[i];
|
|
307
|
+
if (c === '-') {
|
|
308
|
+
uuid += '-';
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
let r;
|
|
312
|
+
if (hasCrypto && randomBytes) {
|
|
313
|
+
// Each byte gives two hex digits (nibbles)
|
|
314
|
+
r = i % 2 === 0 ? randomBytes[byteIndex] >> 4 : randomBytes[byteIndex++] & 0x0f;
|
|
315
|
+
} else {
|
|
316
|
+
r = Math.floor(Math.random() * 16);
|
|
317
|
+
}
|
|
318
|
+
if (c === 'x') {
|
|
319
|
+
uuid += HEX_CHARS[r];
|
|
320
|
+
} else if (c === 'y') {
|
|
321
|
+
// Variant bits: 8, 9, A, or B
|
|
322
|
+
uuid += HEX_CHARS[r & 0x3 | 0x8];
|
|
323
|
+
} else if (c === '4') {
|
|
324
|
+
uuid += '4';
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return uuid;
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
},
|
|
332
|
+
|
|
333
|
+
});
|
|
334
|
+
// The module cache
|
|
335
|
+
var __webpack_module_cache__ = {};
|
|
336
|
+
|
|
337
|
+
// The require function
|
|
338
|
+
function __webpack_require__(moduleId) {
|
|
339
|
+
|
|
340
|
+
// Check if module is in cache
|
|
341
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
342
|
+
if (cachedModule !== undefined) {
|
|
343
|
+
return cachedModule.exports;
|
|
344
|
+
}
|
|
345
|
+
// Create a new module (and put it into the cache)
|
|
346
|
+
var module = (__webpack_module_cache__[moduleId] = {
|
|
347
|
+
exports: {}
|
|
348
|
+
});
|
|
349
|
+
// Execute the module function
|
|
350
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
351
|
+
|
|
352
|
+
// Return the exports of the module
|
|
353
|
+
return module.exports;
|
|
354
|
+
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// webpack/runtime/define_property_getters
|
|
358
|
+
(() => {
|
|
359
|
+
__webpack_require__.d = (exports, definition) => {
|
|
360
|
+
for(var key in definition) {
|
|
361
|
+
if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
362
|
+
Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
})();
|
|
367
|
+
// webpack/runtime/has_own_property
|
|
368
|
+
(() => {
|
|
369
|
+
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
370
|
+
})();
|
|
371
|
+
var __webpack_exports__ = {};
|
|
372
|
+
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
|
|
373
|
+
(() => {
|
|
374
|
+
|
|
375
|
+
// EXPORTS
|
|
376
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
377
|
+
nS: () => (/* reexport */ Capability),
|
|
378
|
+
VP: () => (/* reexport */ PerformanceCapability),
|
|
379
|
+
XO: () => (/* reexport */ TracingCapability)
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
;// CONCATENATED MODULE: ./src/capabilities/Capability.ts
|
|
7
383
|
class Capability {
|
|
8
384
|
excludedNames = new Set([
|
|
9
385
|
"Array",
|
|
@@ -20,6 +396,7 @@ class Capability {
|
|
|
20
396
|
"SchemaDefault",
|
|
21
397
|
"SchemaDeserialize",
|
|
22
398
|
"SchemaDistinct",
|
|
399
|
+
"SchemaSearchable",
|
|
23
400
|
"SchemaFrom",
|
|
24
401
|
"SchemaIdentity",
|
|
25
402
|
"SchemaIndex",
|
|
@@ -38,10 +415,7 @@ class Capability {
|
|
|
38
415
|
return typeof obj === "object" && obj !== null;
|
|
39
416
|
}
|
|
40
417
|
isCallableMethod(descriptor, key) {
|
|
41
|
-
return
|
|
42
|
-
typeof descriptor.value === 'function' &&
|
|
43
|
-
key !== 'constructor' &&
|
|
44
|
-
key !== 'undefined');
|
|
418
|
+
return descriptor?.value && typeof descriptor.value === 'function' && key !== 'constructor' && key !== 'undefined';
|
|
45
419
|
}
|
|
46
420
|
canExplore(descriptor) {
|
|
47
421
|
if (typeof descriptor.value !== "object") {
|
|
@@ -64,8 +438,11 @@ class Capability {
|
|
|
64
438
|
}
|
|
65
439
|
getPath(info, propertyName) {
|
|
66
440
|
let parent = info.parent;
|
|
67
|
-
const path = [
|
|
68
|
-
|
|
441
|
+
const path = [
|
|
442
|
+
info.propertyName,
|
|
443
|
+
propertyName
|
|
444
|
+
];
|
|
445
|
+
while(parent != null){
|
|
69
446
|
path.unshift(parent.propertyName);
|
|
70
447
|
parent = parent.parent;
|
|
71
448
|
}
|
|
@@ -75,9 +452,14 @@ class Capability {
|
|
|
75
452
|
if (!this.isValidObject(instance)) {
|
|
76
453
|
return;
|
|
77
454
|
}
|
|
78
|
-
const explore = [
|
|
455
|
+
const explore = [
|
|
456
|
+
{
|
|
457
|
+
instance,
|
|
458
|
+
propertyName: this.getName(instance)
|
|
459
|
+
}
|
|
460
|
+
];
|
|
79
461
|
const visited = new Set();
|
|
80
|
-
for
|
|
462
|
+
for(let i = 0; i < explore.length; i++){
|
|
81
463
|
const info = explore[i];
|
|
82
464
|
const item = info.instance;
|
|
83
465
|
if (visited.has(item)) {
|
|
@@ -85,9 +467,9 @@ class Capability {
|
|
|
85
467
|
}
|
|
86
468
|
const allKeys = [
|
|
87
469
|
...Object.getOwnPropertyNames(item),
|
|
88
|
-
...Object.getOwnPropertySymbols(item)
|
|
470
|
+
...Object.getOwnPropertySymbols(item)
|
|
89
471
|
];
|
|
90
|
-
for (const key of allKeys)
|
|
472
|
+
for (const key of allKeys){
|
|
91
473
|
const descriptor = Object.getOwnPropertyDescriptor(item, key);
|
|
92
474
|
const isCallable = this.isCallableMethod(descriptor, key);
|
|
93
475
|
onDiscover(info, {
|
|
@@ -98,46 +480,159 @@ class Capability {
|
|
|
98
480
|
continue;
|
|
99
481
|
}
|
|
100
482
|
const path = this.getPath(info, key);
|
|
101
|
-
explore.push({
|
|
483
|
+
explore.push({
|
|
484
|
+
instance: descriptor.value,
|
|
485
|
+
parent: info,
|
|
486
|
+
propertyName: key,
|
|
487
|
+
path
|
|
488
|
+
});
|
|
102
489
|
}
|
|
103
490
|
visited.add(item);
|
|
104
491
|
}
|
|
105
492
|
}
|
|
106
493
|
}
|
|
107
494
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
class PerformanceCapability extends _Capability__rspack_import_0.Capability {
|
|
126
|
-
callTraceManager;
|
|
127
|
-
performanceTracker;
|
|
128
|
-
filter;
|
|
129
|
-
childDurations = new Map();
|
|
130
|
-
constructor(options) {
|
|
131
|
-
super();
|
|
132
|
-
this.filter = options?.filter ?? (() => true);
|
|
133
|
-
this.callTraceManager = new _tracing_CallTraceManager__rspack_import_1.CallTraceManager();
|
|
134
|
-
this.performanceTracker = new _performance_PerformanceTracker__rspack_import_2.PerformanceTracker();
|
|
495
|
+
// EXTERNAL MODULE: ./src/utilities/strings.ts
|
|
496
|
+
var strings = __webpack_require__(615);
|
|
497
|
+
;// CONCATENATED MODULE: ./src/capabilities/performance/PerformanceTracker.ts
|
|
498
|
+
class PerformanceTracker {
|
|
499
|
+
methodTimings = new Map();
|
|
500
|
+
operationStartTimes = new Map();
|
|
501
|
+
startMethodTiming(operationId, methodPath) {
|
|
502
|
+
const startTime = performance.now();
|
|
503
|
+
const key = `${operationId}:${methodPath}`;
|
|
504
|
+
// Track operation start time for delta calculations
|
|
505
|
+
if (!this.operationStartTimes.has(operationId)) {
|
|
506
|
+
this.operationStartTimes.set(operationId, startTime);
|
|
507
|
+
}
|
|
508
|
+
this.methodTimings.set(key, {
|
|
509
|
+
startTime
|
|
510
|
+
});
|
|
511
|
+
return startTime;
|
|
135
512
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
513
|
+
recordNextMethodStart(operationId, methodPath) {
|
|
514
|
+
const key = `${operationId}:${methodPath}`;
|
|
515
|
+
const timing = this.methodTimings.get(key);
|
|
516
|
+
if (timing) {
|
|
517
|
+
timing.nextMethodStartTime = performance.now();
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
endMethodTiming(operationId, methodPath) {
|
|
521
|
+
const endTime = performance.now();
|
|
522
|
+
const key = `${operationId}:${methodPath}`;
|
|
523
|
+
const timing = this.methodTimings.get(key);
|
|
524
|
+
if (!timing) {
|
|
525
|
+
return {
|
|
526
|
+
startTime: endTime
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
const duration = endTime - timing.startTime;
|
|
530
|
+
const timeToNextCall = timing.nextMethodStartTime ? timing.nextMethodStartTime - timing.startTime : undefined;
|
|
531
|
+
// Clean up
|
|
532
|
+
this.methodTimings.delete(key);
|
|
533
|
+
return {
|
|
534
|
+
startTime: timing.startTime,
|
|
535
|
+
endTime,
|
|
536
|
+
duration,
|
|
537
|
+
nextMethodStartTime: timing.nextMethodStartTime,
|
|
538
|
+
timeToNextCall
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
formatDuration(milliseconds) {
|
|
542
|
+
if (milliseconds < 1) {
|
|
543
|
+
return `${(milliseconds * 1000).toFixed(1)}μs`;
|
|
544
|
+
} else if (milliseconds < 1000) {
|
|
545
|
+
return `${milliseconds.toFixed(2)}ms`;
|
|
546
|
+
} else {
|
|
547
|
+
return `${(milliseconds / 1000).toFixed(2)}s`;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
getDeltaFromOperationStart(operationId, currentTime) {
|
|
551
|
+
const operationStartTime = this.operationStartTimes.get(operationId);
|
|
552
|
+
return operationStartTime ? currentTime - operationStartTime : 0;
|
|
553
|
+
}
|
|
554
|
+
cleanupOperation(operationId) {
|
|
555
|
+
this.operationStartTimes.delete(operationId);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
// EXTERNAL MODULE: ./src/utilities/uuid.ts
|
|
560
|
+
var uuid = __webpack_require__(618);
|
|
561
|
+
;// CONCATENATED MODULE: ./src/capabilities/tracing/CallTraceManager.ts
|
|
562
|
+
|
|
563
|
+
class CallTraceManager {
|
|
564
|
+
activeOperationId = null;
|
|
565
|
+
activeCallStack = [];
|
|
566
|
+
startNewOperation() {
|
|
567
|
+
const operationId = (0,uuid/* .uuid */.u)(8);
|
|
568
|
+
this.activeOperationId = operationId;
|
|
569
|
+
this.activeCallStack = [];
|
|
570
|
+
return operationId;
|
|
571
|
+
}
|
|
572
|
+
isNewOperation() {
|
|
573
|
+
return this.activeOperationId === null;
|
|
574
|
+
}
|
|
575
|
+
getActiveOperationId() {
|
|
576
|
+
if (!this.activeOperationId) {
|
|
577
|
+
throw new Error('No active operation context');
|
|
578
|
+
}
|
|
579
|
+
return this.activeOperationId;
|
|
580
|
+
}
|
|
581
|
+
addMethodToTrace(methodPath) {
|
|
582
|
+
if (this.isNewOperation()) {
|
|
583
|
+
this.activeCallStack = [
|
|
584
|
+
methodPath
|
|
585
|
+
];
|
|
586
|
+
} else {
|
|
587
|
+
this.activeCallStack.push(methodPath);
|
|
588
|
+
}
|
|
589
|
+
return [
|
|
590
|
+
...this.activeCallStack
|
|
591
|
+
];
|
|
592
|
+
}
|
|
593
|
+
removeMethodFromTrace() {
|
|
594
|
+
if (!this.isNewOperation()) {
|
|
595
|
+
this.activeCallStack.pop();
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
endOperation() {
|
|
599
|
+
this.activeOperationId = null;
|
|
600
|
+
this.activeCallStack = [];
|
|
601
|
+
}
|
|
602
|
+
formatMethodPaths(methodPaths) {
|
|
603
|
+
return methodPaths.map((path)=>path.replace(/ → /g, '.'));
|
|
604
|
+
}
|
|
605
|
+
getCurrentTrace() {
|
|
606
|
+
return [
|
|
607
|
+
...this.activeCallStack
|
|
608
|
+
];
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
// EXTERNAL MODULE: ./src/utilities/logger.ts
|
|
613
|
+
var logger = __webpack_require__(581);
|
|
614
|
+
;// CONCATENATED MODULE: ./src/capabilities/PerformanceCapability.ts
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
class PerformanceCapability extends Capability {
|
|
621
|
+
callTraceManager;
|
|
622
|
+
performanceTracker;
|
|
623
|
+
filter;
|
|
624
|
+
childDurations = new Map();
|
|
625
|
+
constructor(options){
|
|
626
|
+
super();
|
|
627
|
+
this.filter = options?.filter ?? (()=>true);
|
|
628
|
+
this.callTraceManager = new CallTraceManager();
|
|
629
|
+
this.performanceTracker = new PerformanceTracker();
|
|
630
|
+
}
|
|
631
|
+
apply(instance) {
|
|
632
|
+
this.explore(instance, (meta, info)=>{
|
|
633
|
+
if (info.isCallable) {
|
|
634
|
+
const originalMethod = meta.instance[info.name].bind(meta.instance);
|
|
635
|
+
meta.instance[info.name] = (...args)=>{
|
|
141
636
|
const path = `${meta.path}.${String(info.name)}()`;
|
|
142
637
|
if (this.filter(path, info, meta) === false) {
|
|
143
638
|
return originalMethod(...args);
|
|
@@ -153,14 +648,13 @@ class PerformanceCapability extends _Capability__rspack_import_0.Capability {
|
|
|
153
648
|
depth = callTrace.length - 1;
|
|
154
649
|
const formattedCallTrace = this.callTraceManager.formatMethodPaths(callTrace);
|
|
155
650
|
this.performanceTracker.startMethodTiming(operationId, path);
|
|
156
|
-
|
|
157
|
-
|
|
651
|
+
logger/* .logger.log */.vF.log(`\n${'═'.repeat(60)}`);
|
|
652
|
+
logger/* .logger.log */.vF.log(`▶ ORIGIN [${operationId}] ${path}`);
|
|
158
653
|
if (args.length > 0) {
|
|
159
|
-
|
|
654
|
+
logger/* .logger.log */.vF.log(` Args:`, (0,strings/* .stringifyObject */.Zm)(args, 4, 0));
|
|
160
655
|
}
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
656
|
+
logger/* .logger.log */.vF.log(` Call Stack: ${formattedCallTrace.join(' → ')}`);
|
|
657
|
+
} else {
|
|
164
658
|
operationId = this.callTraceManager.getActiveOperationId();
|
|
165
659
|
callTrace = this.callTraceManager.addMethodToTrace(path);
|
|
166
660
|
depth = callTrace.length - 1;
|
|
@@ -169,47 +663,45 @@ class PerformanceCapability extends _Capability__rspack_import_0.Capability {
|
|
|
169
663
|
const childMethodKey = `${operationId}:${path}`;
|
|
170
664
|
this.childDurations.set(childMethodKey, []);
|
|
171
665
|
this.performanceTracker.startMethodTiming(operationId, path);
|
|
172
|
-
|
|
666
|
+
logger/* .logger.log */.vF.log(`${indent}└─ CHILD [${operationId}] ${path}`);
|
|
173
667
|
if (args.length > 0) {
|
|
174
|
-
|
|
668
|
+
logger/* .logger.log */.vF.log(`${indent} Args:`, (0,strings/* .stringifyObject */.Zm)(args, 4, 0));
|
|
175
669
|
}
|
|
176
670
|
}
|
|
177
671
|
try {
|
|
178
672
|
return originalMethod(...args);
|
|
179
|
-
}
|
|
180
|
-
finally {
|
|
673
|
+
} finally{
|
|
181
674
|
const metrics = this.performanceTracker.endMethodTiming(operationId, path);
|
|
182
675
|
const duration = metrics.duration ?? 0;
|
|
183
676
|
const formattedDuration = this.performanceTracker.formatDuration(duration);
|
|
184
677
|
if (isNewOperation) {
|
|
185
678
|
const childDurations = this.childDurations.get(operationId) ?? [];
|
|
186
|
-
const totalChildTime = childDurations.reduce((sum, d)
|
|
679
|
+
const totalChildTime = childDurations.reduce((sum, d)=>sum + d, 0);
|
|
187
680
|
const formattedTotalChildTime = this.performanceTracker.formatDuration(totalChildTime);
|
|
188
681
|
const overhead = duration - totalChildTime;
|
|
189
682
|
const formattedOverhead = this.performanceTracker.formatDuration(Math.max(0, overhead));
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
683
|
+
logger/* .logger.log */.vF.log(`\n${'═'.repeat(60)}`);
|
|
684
|
+
logger/* .logger.log */.vF.log(`◀ COMPLETE [${operationId}] ${path}`);
|
|
685
|
+
logger/* .logger.log */.vF.log(` Total Duration: ${formattedDuration}`);
|
|
193
686
|
if (childDurations.length > 0) {
|
|
194
|
-
|
|
195
|
-
|
|
687
|
+
logger/* .logger.log */.vF.log(` Children Duration: ${formattedTotalChildTime} (${childDurations.length} calls)`);
|
|
688
|
+
logger/* .logger.log */.vF.log(` Overhead: ${formattedOverhead}`);
|
|
196
689
|
}
|
|
197
|
-
|
|
690
|
+
logger/* .logger.log */.vF.log(`${'═'.repeat(60)}\n`);
|
|
198
691
|
this.childDurations.delete(operationId);
|
|
199
692
|
this.performanceTracker.cleanupOperation(operationId);
|
|
200
693
|
this.callTraceManager.endOperation();
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
694
|
+
} else {
|
|
203
695
|
const indent = ' '.repeat(Math.min(depth, 4));
|
|
204
696
|
const childMethodKey = `${operationId}:${path}`;
|
|
205
697
|
const childDurations = this.childDurations.get(childMethodKey) ?? [];
|
|
206
|
-
const totalChildTime = childDurations.reduce((sum, d)
|
|
698
|
+
const totalChildTime = childDurations.reduce((sum, d)=>sum + d, 0);
|
|
207
699
|
const formattedTotalChildTime = this.performanceTracker.formatDuration(totalChildTime);
|
|
208
700
|
const overhead = duration - totalChildTime;
|
|
209
701
|
const formattedOverhead = this.performanceTracker.formatDuration(Math.max(0, overhead));
|
|
210
|
-
|
|
702
|
+
logger/* .logger.log */.vF.log(`${indent} ✓ ${formattedDuration}`);
|
|
211
703
|
if (childDurations.length > 0) {
|
|
212
|
-
|
|
704
|
+
logger/* .logger.log */.vF.log(`${indent} Children: ${formattedTotalChildTime} (${childDurations.length} calls), Overhead: ${formattedOverhead}`);
|
|
213
705
|
}
|
|
214
706
|
// Clean up child method tracking
|
|
215
707
|
this.childDurations.delete(childMethodKey);
|
|
@@ -226,8 +718,7 @@ class PerformanceCapability extends _Capability__rspack_import_0.Capability {
|
|
|
226
718
|
if (rootChildDurations) {
|
|
227
719
|
rootChildDurations.push(duration);
|
|
228
720
|
}
|
|
229
|
-
}
|
|
230
|
-
else {
|
|
721
|
+
} else {
|
|
231
722
|
// Nested child - add to parent method's children list
|
|
232
723
|
const parentMethodKey = `${operationId}:${parentPath}`;
|
|
233
724
|
const parentChildDurations = this.childDurations.get(parentMethodKey);
|
|
@@ -245,34 +736,23 @@ class PerformanceCapability extends _Capability__rspack_import_0.Capability {
|
|
|
245
736
|
}
|
|
246
737
|
}
|
|
247
738
|
|
|
248
|
-
|
|
249
|
-
},
|
|
250
|
-
"./src/capabilities/TracingCapability.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
251
|
-
__webpack_require__.r(__webpack_exports__);
|
|
252
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
253
|
-
TracingCapability: () => (TracingCapability)
|
|
254
|
-
});
|
|
255
|
-
/* import */ var _Capability__rspack_import_0 = __webpack_require__("./src/capabilities/Capability.ts");
|
|
256
|
-
/* import */ var _tracing_CallTraceManager__rspack_import_1 = __webpack_require__("./src/capabilities/tracing/CallTraceManager.ts");
|
|
257
|
-
/* import */ var _utilities_strings__rspack_import_3 = __webpack_require__("./src/utilities/strings.ts");
|
|
258
|
-
/* import */ var _utilities__rspack_import_2 = __webpack_require__("./src/utilities/logger.ts");
|
|
739
|
+
;// CONCATENATED MODULE: ./src/capabilities/TracingCapability.ts
|
|
259
740
|
|
|
260
741
|
|
|
261
742
|
|
|
262
|
-
|
|
263
|
-
class TracingCapability extends _Capability__rspack_import_0.Capability {
|
|
743
|
+
class TracingCapability extends Capability {
|
|
264
744
|
callTraceManager;
|
|
265
745
|
filter;
|
|
266
|
-
constructor(options)
|
|
746
|
+
constructor(options){
|
|
267
747
|
super();
|
|
268
|
-
this.filter = options?.filter ?? (()
|
|
269
|
-
this.callTraceManager = new
|
|
748
|
+
this.filter = options?.filter ?? (()=>true);
|
|
749
|
+
this.callTraceManager = new CallTraceManager();
|
|
270
750
|
}
|
|
271
751
|
apply(instance) {
|
|
272
|
-
this.explore(instance, (meta, info)
|
|
752
|
+
this.explore(instance, (meta, info)=>{
|
|
273
753
|
if (info.isCallable) {
|
|
274
754
|
const originalMethod = meta.instance[info.name].bind(meta.instance);
|
|
275
|
-
meta.instance[info.name] = (...args)
|
|
755
|
+
meta.instance[info.name] = (...args)=>{
|
|
276
756
|
const path = `${meta.path}.${String(info.name)}()`;
|
|
277
757
|
if (this.filter(path, info, meta) === false) {
|
|
278
758
|
return originalMethod(...args);
|
|
@@ -283,26 +763,24 @@ class TracingCapability extends _Capability__rspack_import_0.Capability {
|
|
|
283
763
|
operationId = this.callTraceManager.startNewOperation();
|
|
284
764
|
const callTrace = this.callTraceManager.addMethodToTrace(path);
|
|
285
765
|
const formattedCallTrace = this.callTraceManager.formatMethodPaths(callTrace);
|
|
286
|
-
|
|
287
|
-
|
|
766
|
+
console.log(`\n${'═'.repeat(60)}`);
|
|
767
|
+
console.log(`▶ ORIGIN [${operationId}] ${path}`);
|
|
288
768
|
if (args.length > 0) {
|
|
289
|
-
|
|
769
|
+
console.log(` Args:`, (0,strings/* .stringifyObject */.Zm)(args, 4, 0));
|
|
290
770
|
}
|
|
291
|
-
|
|
292
|
-
}
|
|
293
|
-
else {
|
|
771
|
+
console.log(` Call Stack: ${formattedCallTrace.join(' → ')}`);
|
|
772
|
+
} else {
|
|
294
773
|
operationId = this.callTraceManager.getActiveOperationId();
|
|
295
774
|
const callTrace = this.callTraceManager.addMethodToTrace(path);
|
|
296
775
|
const indent = ' '.repeat(Math.min(callTrace.length - 1, 4));
|
|
297
|
-
|
|
776
|
+
console.log(`${indent}└─ CHILD [${operationId}] ${path}`);
|
|
298
777
|
if (args.length > 0) {
|
|
299
|
-
|
|
778
|
+
console.log(`${indent} Args:`, (0,strings/* .stringifyObject */.Zm)(args, 4, 0));
|
|
300
779
|
}
|
|
301
780
|
}
|
|
302
781
|
try {
|
|
303
782
|
return originalMethod(...args);
|
|
304
|
-
}
|
|
305
|
-
finally {
|
|
783
|
+
} finally{
|
|
306
784
|
this.callTraceManager.removeMethodFromTrace();
|
|
307
785
|
if (isNewOperation) {
|
|
308
786
|
this.callTraceManager.endOperation();
|
|
@@ -314,450 +792,7 @@ class TracingCapability extends _Capability__rspack_import_0.Capability {
|
|
|
314
792
|
}
|
|
315
793
|
}
|
|
316
794
|
|
|
317
|
-
|
|
318
|
-
},
|
|
319
|
-
"./src/capabilities/performance/PerformanceTracker.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
320
|
-
__webpack_require__.r(__webpack_exports__);
|
|
321
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
322
|
-
PerformanceTracker: () => (PerformanceTracker)
|
|
323
|
-
});
|
|
324
|
-
class PerformanceTracker {
|
|
325
|
-
methodTimings = new Map();
|
|
326
|
-
operationStartTimes = new Map();
|
|
327
|
-
startMethodTiming(operationId, methodPath) {
|
|
328
|
-
const startTime = performance.now();
|
|
329
|
-
const key = `${operationId}:${methodPath}`;
|
|
330
|
-
// Track operation start time for delta calculations
|
|
331
|
-
if (!this.operationStartTimes.has(operationId)) {
|
|
332
|
-
this.operationStartTimes.set(operationId, startTime);
|
|
333
|
-
}
|
|
334
|
-
this.methodTimings.set(key, { startTime });
|
|
335
|
-
return startTime;
|
|
336
|
-
}
|
|
337
|
-
recordNextMethodStart(operationId, methodPath) {
|
|
338
|
-
const key = `${operationId}:${methodPath}`;
|
|
339
|
-
const timing = this.methodTimings.get(key);
|
|
340
|
-
if (timing) {
|
|
341
|
-
timing.nextMethodStartTime = performance.now();
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
endMethodTiming(operationId, methodPath) {
|
|
345
|
-
const endTime = performance.now();
|
|
346
|
-
const key = `${operationId}:${methodPath}`;
|
|
347
|
-
const timing = this.methodTimings.get(key);
|
|
348
|
-
if (!timing) {
|
|
349
|
-
return { startTime: endTime };
|
|
350
|
-
}
|
|
351
|
-
const duration = endTime - timing.startTime;
|
|
352
|
-
const timeToNextCall = timing.nextMethodStartTime ?
|
|
353
|
-
timing.nextMethodStartTime - timing.startTime : undefined;
|
|
354
|
-
// Clean up
|
|
355
|
-
this.methodTimings.delete(key);
|
|
356
|
-
return {
|
|
357
|
-
startTime: timing.startTime,
|
|
358
|
-
endTime,
|
|
359
|
-
duration,
|
|
360
|
-
nextMethodStartTime: timing.nextMethodStartTime,
|
|
361
|
-
timeToNextCall
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
formatDuration(milliseconds) {
|
|
365
|
-
if (milliseconds < 1) {
|
|
366
|
-
return `${(milliseconds * 1000).toFixed(1)}μs`;
|
|
367
|
-
}
|
|
368
|
-
else if (milliseconds < 1000) {
|
|
369
|
-
return `${milliseconds.toFixed(2)}ms`;
|
|
370
|
-
}
|
|
371
|
-
else {
|
|
372
|
-
return `${(milliseconds / 1000).toFixed(2)}s`;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
getDeltaFromOperationStart(operationId, currentTime) {
|
|
376
|
-
const operationStartTime = this.operationStartTimes.get(operationId);
|
|
377
|
-
return operationStartTime ? currentTime - operationStartTime : 0;
|
|
378
|
-
}
|
|
379
|
-
cleanupOperation(operationId) {
|
|
380
|
-
this.operationStartTimes.delete(operationId);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
},
|
|
386
|
-
"./src/capabilities/tracing/CallTraceManager.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
387
|
-
__webpack_require__.r(__webpack_exports__);
|
|
388
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
389
|
-
CallTraceManager: () => (CallTraceManager)
|
|
390
|
-
});
|
|
391
|
-
/* import */ var _utilities__rspack_import_0 = __webpack_require__("./src/utilities/uuid.ts");
|
|
392
|
-
|
|
393
|
-
class CallTraceManager {
|
|
394
|
-
activeOperationId = null;
|
|
395
|
-
activeCallStack = [];
|
|
396
|
-
startNewOperation() {
|
|
397
|
-
const operationId = (0,_utilities__rspack_import_0.uuid)(8);
|
|
398
|
-
this.activeOperationId = operationId;
|
|
399
|
-
this.activeCallStack = [];
|
|
400
|
-
return operationId;
|
|
401
|
-
}
|
|
402
|
-
isNewOperation() {
|
|
403
|
-
return this.activeOperationId === null;
|
|
404
|
-
}
|
|
405
|
-
getActiveOperationId() {
|
|
406
|
-
if (!this.activeOperationId) {
|
|
407
|
-
throw new Error('No active operation context');
|
|
408
|
-
}
|
|
409
|
-
return this.activeOperationId;
|
|
410
|
-
}
|
|
411
|
-
addMethodToTrace(methodPath) {
|
|
412
|
-
if (this.isNewOperation()) {
|
|
413
|
-
this.activeCallStack = [methodPath];
|
|
414
|
-
}
|
|
415
|
-
else {
|
|
416
|
-
this.activeCallStack.push(methodPath);
|
|
417
|
-
}
|
|
418
|
-
return [...this.activeCallStack];
|
|
419
|
-
}
|
|
420
|
-
removeMethodFromTrace() {
|
|
421
|
-
if (!this.isNewOperation()) {
|
|
422
|
-
this.activeCallStack.pop();
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
endOperation() {
|
|
426
|
-
this.activeOperationId = null;
|
|
427
|
-
this.activeCallStack = [];
|
|
428
|
-
}
|
|
429
|
-
formatMethodPaths(methodPaths) {
|
|
430
|
-
return methodPaths.map(path => path.replace(/ → /g, '.'));
|
|
431
|
-
}
|
|
432
|
-
getCurrentTrace() {
|
|
433
|
-
return [...this.activeCallStack];
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
},
|
|
439
|
-
"./src/utilities/logger.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
440
|
-
__webpack_require__.r(__webpack_exports__);
|
|
441
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
442
|
-
logger: () => (logger)
|
|
443
|
-
});
|
|
444
|
-
const isDevelopment = () => {
|
|
445
|
-
if (typeof process === 'undefined' || process.env == null) {
|
|
446
|
-
return false;
|
|
447
|
-
}
|
|
448
|
-
const env = "development"?.toLowerCase();
|
|
449
|
-
return env === 'dev' || env === 'development' || env === 'test';
|
|
450
|
-
};
|
|
451
|
-
const shouldLog = isDevelopment();
|
|
452
|
-
const tryLog = (type, ...args) => {
|
|
453
|
-
if (shouldLog) {
|
|
454
|
-
console[type](...args);
|
|
455
|
-
}
|
|
456
|
-
};
|
|
457
|
-
const logger = {
|
|
458
|
-
log: (...args) => {
|
|
459
|
-
tryLog("log", ...args);
|
|
460
|
-
},
|
|
461
|
-
info: (...args) => {
|
|
462
|
-
tryLog("info", ...args);
|
|
463
|
-
},
|
|
464
|
-
warn: (...args) => {
|
|
465
|
-
tryLog("warn", ...args);
|
|
466
|
-
},
|
|
467
|
-
error: (...args) => {
|
|
468
|
-
tryLog("error", ...args);
|
|
469
|
-
},
|
|
470
|
-
debug: (...args) => {
|
|
471
|
-
tryLog("debug", ...args);
|
|
472
|
-
},
|
|
473
|
-
table: (...args) => {
|
|
474
|
-
tryLog("table", ...args);
|
|
475
|
-
},
|
|
476
|
-
};
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
},
|
|
480
|
-
"./src/utilities/strings.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
481
|
-
__webpack_require__.r(__webpack_exports__);
|
|
482
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
483
|
-
fastHash: () => (fastHash),
|
|
484
|
-
hash: () => (hash),
|
|
485
|
-
stringifyObject: () => (stringifyObject)
|
|
486
|
-
});
|
|
487
|
-
const hash = (value, seed = 0) => {
|
|
488
|
-
// From Stack Overflow
|
|
489
|
-
// https://stackoverflow.com/a/52171480/3329760
|
|
490
|
-
let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
|
|
491
|
-
for (let i = 0, ch; i < value.length; i++) {
|
|
492
|
-
ch = value.charCodeAt(i);
|
|
493
|
-
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
494
|
-
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
495
|
-
}
|
|
496
|
-
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507);
|
|
497
|
-
h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909);
|
|
498
|
-
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507);
|
|
499
|
-
h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
500
|
-
return 4294967296 * (2097151 & h2) + (h1 >>> 0);
|
|
501
|
-
};
|
|
502
|
-
/**
|
|
503
|
-
* Fast string hash optimized for comparisons.
|
|
504
|
-
* Uses djb2 algorithm - very fast and good distribution for short to medium strings.
|
|
505
|
-
* Same input always produces same output (deterministic).
|
|
506
|
-
*
|
|
507
|
-
* @param value - The string to hash
|
|
508
|
-
* @param seed - Optional seed value (default: 5381)
|
|
509
|
-
* @returns A positive 32-bit integer hash value
|
|
510
|
-
*
|
|
511
|
-
* @example
|
|
512
|
-
* ```ts
|
|
513
|
-
* fastHash("test") === fastHash("test") // true
|
|
514
|
-
* fastHash("test") !== fastHash("test2") // true
|
|
515
|
-
* ```
|
|
516
|
-
*/
|
|
517
|
-
const fastHash = (value, seed = 5381) => {
|
|
518
|
-
let hash = seed;
|
|
519
|
-
for (let i = 0; i < value.length; i++) {
|
|
520
|
-
hash = ((hash << 5) + hash) + value.charCodeAt(i);
|
|
521
|
-
}
|
|
522
|
-
return hash >>> 0; // Convert to unsigned 32-bit integer
|
|
523
|
-
};
|
|
524
|
-
/**
|
|
525
|
-
* Converts any value to a readable string representation.
|
|
526
|
-
* Handles primitives, objects, arrays, classes, dates, errors, and functions.
|
|
527
|
-
* Supports depth limiting to prevent infinite recursion on circular references.
|
|
528
|
-
*
|
|
529
|
-
* @param obj - The value to stringify
|
|
530
|
-
* @param maxDepth - Maximum depth for nested objects (default: 3)
|
|
531
|
-
* @param currentDepth - Current recursion depth (default: 0)
|
|
532
|
-
* @returns String representation of the value
|
|
533
|
-
*
|
|
534
|
-
* @example
|
|
535
|
-
* ```ts
|
|
536
|
-
* stringifyObject({ name: "test", count: 5 }) // '{ name: "test", count: 5 }'
|
|
537
|
-
* stringifyObject([1, 2, 3]) // '[1, 2, 3]'
|
|
538
|
-
* stringifyObject(new Date()) // 'Date(2024-01-01T00:00:00.000Z)'
|
|
539
|
-
* ```
|
|
540
|
-
*/
|
|
541
|
-
function stringifyObject(obj, maxDepth = 3, currentDepth = 0) {
|
|
542
|
-
if (obj === null)
|
|
543
|
-
return 'null';
|
|
544
|
-
if (obj === undefined)
|
|
545
|
-
return 'undefined';
|
|
546
|
-
const type = typeof obj;
|
|
547
|
-
switch (type) {
|
|
548
|
-
case 'string':
|
|
549
|
-
return `"${obj}"`;
|
|
550
|
-
case 'number':
|
|
551
|
-
case 'boolean':
|
|
552
|
-
return String(obj);
|
|
553
|
-
case 'function':
|
|
554
|
-
return `[Function: ${getFunctionName(obj)}]`;
|
|
555
|
-
case 'object':
|
|
556
|
-
if (currentDepth >= maxDepth) {
|
|
557
|
-
return '[Max Depth Reached]';
|
|
558
|
-
}
|
|
559
|
-
return stringifyObjectValue(obj, maxDepth, currentDepth);
|
|
560
|
-
default:
|
|
561
|
-
return `[${type}]`;
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
function getFunctionName(fn) {
|
|
565
|
-
const name = fn.name;
|
|
566
|
-
return name || 'anonymous';
|
|
567
|
-
}
|
|
568
|
-
function getObjectProperties(obj) {
|
|
569
|
-
const properties = {};
|
|
570
|
-
for (const key in obj) {
|
|
571
|
-
if (obj.hasOwnProperty(key)) {
|
|
572
|
-
properties[key] = obj[key];
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
return properties;
|
|
576
|
-
}
|
|
577
|
-
function stringifyObjectValue(obj, maxDepth, currentDepth) {
|
|
578
|
-
if (obj === null)
|
|
579
|
-
return 'null';
|
|
580
|
-
if (obj instanceof Date) {
|
|
581
|
-
return `Date(${obj.toISOString()})`;
|
|
582
|
-
}
|
|
583
|
-
if (obj instanceof Error) {
|
|
584
|
-
return `Error(${obj.message})`;
|
|
585
|
-
}
|
|
586
|
-
if (obj instanceof RegExp) {
|
|
587
|
-
return obj.toString();
|
|
588
|
-
}
|
|
589
|
-
if (Array.isArray(obj)) {
|
|
590
|
-
return stringifyArray(obj, maxDepth, currentDepth);
|
|
591
|
-
}
|
|
592
|
-
if (obj.constructor && obj.constructor.name !== 'Object') {
|
|
593
|
-
return stringifyClassInstance(obj, maxDepth, currentDepth);
|
|
594
|
-
}
|
|
595
|
-
return stringifyPlainObject(obj, maxDepth, currentDepth);
|
|
596
|
-
}
|
|
597
|
-
function stringifyArray(arr, maxDepth, currentDepth) {
|
|
598
|
-
if (arr.length === 0)
|
|
599
|
-
return '[]';
|
|
600
|
-
const items = arr.slice(0, 5).map(item => stringifyObject(item, maxDepth, currentDepth + 1));
|
|
601
|
-
const suffix = arr.length > 5 ? `... (+${arr.length - 5} more)` : '';
|
|
602
|
-
return `[${items.join(', ')}${suffix}]`;
|
|
603
|
-
}
|
|
604
|
-
function stringifyClassInstance(obj, maxDepth, currentDepth) {
|
|
605
|
-
const className = obj.constructor.name;
|
|
606
|
-
const properties = getObjectProperties(obj);
|
|
607
|
-
if (Object.keys(properties).length === 0) {
|
|
608
|
-
return `${className} {}`;
|
|
609
|
-
}
|
|
610
|
-
const props = Object.entries(properties)
|
|
611
|
-
.slice(0, 5)
|
|
612
|
-
.map(([key, value]) => {
|
|
613
|
-
const isPrimitive = value === null || value === undefined ||
|
|
614
|
-
(typeof value !== 'object' && typeof value !== 'function');
|
|
615
|
-
const depth = isPrimitive ? currentDepth : currentDepth + 1;
|
|
616
|
-
return `${key}: ${stringifyObject(value, maxDepth, depth)}`;
|
|
617
|
-
});
|
|
618
|
-
const suffix = Object.keys(properties).length > 5 ?
|
|
619
|
-
`... (+${Object.keys(properties).length - 5} more)` : '';
|
|
620
|
-
return `${className} { ${props.join(', ')}${suffix} }`;
|
|
621
|
-
}
|
|
622
|
-
function stringifyPlainObject(obj, maxDepth, currentDepth) {
|
|
623
|
-
const properties = getObjectProperties(obj);
|
|
624
|
-
if (Object.keys(properties).length === 0) {
|
|
625
|
-
return '{}';
|
|
626
|
-
}
|
|
627
|
-
const props = Object.entries(properties)
|
|
628
|
-
.slice(0, 5)
|
|
629
|
-
.map(([key, value]) => {
|
|
630
|
-
const isPrimitive = value === null || value === undefined ||
|
|
631
|
-
(typeof value !== 'object' && typeof value !== 'function');
|
|
632
|
-
const depth = isPrimitive ? currentDepth : currentDepth + 1;
|
|
633
|
-
return `${key}: ${stringifyObject(value, maxDepth, depth)}`;
|
|
634
|
-
});
|
|
635
|
-
const suffix = Object.keys(properties).length > 5 ?
|
|
636
|
-
`... (+${Object.keys(properties).length - 5} more)` : '';
|
|
637
|
-
return `{ ${props.join(', ')}${suffix} }`;
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
},
|
|
642
|
-
"./src/utilities/uuid.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
643
|
-
__webpack_require__.r(__webpack_exports__);
|
|
644
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
645
|
-
uuid: () => (uuid),
|
|
646
|
-
uuidv4: () => (uuidv4)
|
|
647
|
-
});
|
|
648
|
-
const uuid = (length = 16) => {
|
|
649
|
-
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
650
|
-
const charLength = chars.length;
|
|
651
|
-
let result = '';
|
|
652
|
-
for (let i = 0; i < length; i++) {
|
|
653
|
-
result += chars[Math.random() * charLength | 0];
|
|
654
|
-
}
|
|
655
|
-
return result;
|
|
656
|
-
};
|
|
657
|
-
const HEX_CHARS = '0123456789abcdef';
|
|
658
|
-
const UUID_TEMPLATE = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
|
|
659
|
-
const hasCrypto = typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function';
|
|
660
|
-
const uuidv4 = () => {
|
|
661
|
-
let randomBytes = null;
|
|
662
|
-
if (hasCrypto) {
|
|
663
|
-
randomBytes = crypto.getRandomValues(new Uint8Array(16));
|
|
664
|
-
}
|
|
665
|
-
let byteIndex = 0;
|
|
666
|
-
let uuid = '';
|
|
667
|
-
for (let i = 0; i < UUID_TEMPLATE.length; i++) {
|
|
668
|
-
const c = UUID_TEMPLATE[i];
|
|
669
|
-
if (c === '-') {
|
|
670
|
-
uuid += '-';
|
|
671
|
-
continue;
|
|
672
|
-
}
|
|
673
|
-
let r;
|
|
674
|
-
if (hasCrypto && randomBytes) {
|
|
675
|
-
// Each byte gives two hex digits (nibbles)
|
|
676
|
-
r =
|
|
677
|
-
(i % 2 === 0
|
|
678
|
-
? randomBytes[byteIndex] >> 4
|
|
679
|
-
: randomBytes[byteIndex++] & 0x0f);
|
|
680
|
-
}
|
|
681
|
-
else {
|
|
682
|
-
r = Math.floor(Math.random() * 16);
|
|
683
|
-
}
|
|
684
|
-
if (c === 'x') {
|
|
685
|
-
uuid += HEX_CHARS[r];
|
|
686
|
-
}
|
|
687
|
-
else if (c === 'y') {
|
|
688
|
-
// Variant bits: 8, 9, A, or B
|
|
689
|
-
uuid += HEX_CHARS[(r & 0x3) | 0x8];
|
|
690
|
-
}
|
|
691
|
-
else if (c === '4') {
|
|
692
|
-
uuid += '4';
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
return uuid;
|
|
696
|
-
};
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
},
|
|
700
|
-
|
|
701
|
-
});
|
|
702
|
-
// The module cache
|
|
703
|
-
var __webpack_module_cache__ = {};
|
|
704
|
-
|
|
705
|
-
// The require function
|
|
706
|
-
function __webpack_require__(moduleId) {
|
|
707
|
-
|
|
708
|
-
// Check if module is in cache
|
|
709
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
710
|
-
if (cachedModule !== undefined) {
|
|
711
|
-
return cachedModule.exports;
|
|
712
|
-
}
|
|
713
|
-
// Create a new module (and put it into the cache)
|
|
714
|
-
var module = (__webpack_module_cache__[moduleId] = {
|
|
715
|
-
exports: {}
|
|
716
|
-
});
|
|
717
|
-
// Execute the module function
|
|
718
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
719
|
-
|
|
720
|
-
// Return the exports of the module
|
|
721
|
-
return module.exports;
|
|
722
|
-
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
// webpack/runtime/define_property_getters
|
|
726
|
-
(() => {
|
|
727
|
-
__webpack_require__.d = (exports, definition) => {
|
|
728
|
-
for(var key in definition) {
|
|
729
|
-
if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
730
|
-
Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
};
|
|
734
|
-
})();
|
|
735
|
-
// webpack/runtime/has_own_property
|
|
736
|
-
(() => {
|
|
737
|
-
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
738
|
-
})();
|
|
739
|
-
// webpack/runtime/make_namespace_object
|
|
740
|
-
(() => {
|
|
741
|
-
// define __esModule on exports
|
|
742
|
-
__webpack_require__.r = (exports) => {
|
|
743
|
-
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
744
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
745
|
-
}
|
|
746
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
747
|
-
};
|
|
748
|
-
})();
|
|
749
|
-
var __webpack_exports__ = {};
|
|
750
|
-
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
|
|
751
|
-
(() => {
|
|
752
|
-
__webpack_require__.r(__webpack_exports__);
|
|
753
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
754
|
-
Capability: () => (/* reexport safe */ _Capability__rspack_import_0.Capability),
|
|
755
|
-
PerformanceCapability: () => (/* reexport safe */ _PerformanceCapability__rspack_import_1.PerformanceCapability),
|
|
756
|
-
TracingCapability: () => (/* reexport safe */ _TracingCapability__rspack_import_2.TracingCapability)
|
|
757
|
-
});
|
|
758
|
-
/* import */ var _Capability__rspack_import_0 = __webpack_require__("./src/capabilities/Capability.ts");
|
|
759
|
-
/* import */ var _PerformanceCapability__rspack_import_1 = __webpack_require__("./src/capabilities/PerformanceCapability.ts");
|
|
760
|
-
/* import */ var _TracingCapability__rspack_import_2 = __webpack_require__("./src/capabilities/TracingCapability.ts");
|
|
795
|
+
;// CONCATENATED MODULE: ./src/capabilities/index.ts
|
|
761
796
|
|
|
762
797
|
|
|
763
798
|
|
|
@@ -765,9 +800,9 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
765
800
|
|
|
766
801
|
})();
|
|
767
802
|
|
|
768
|
-
var __webpack_exports__Capability = __webpack_exports__.
|
|
769
|
-
var __webpack_exports__PerformanceCapability = __webpack_exports__.
|
|
770
|
-
var __webpack_exports__TracingCapability = __webpack_exports__.
|
|
803
|
+
var __webpack_exports__Capability = __webpack_exports__.nS;
|
|
804
|
+
var __webpack_exports__PerformanceCapability = __webpack_exports__.VP;
|
|
805
|
+
var __webpack_exports__TracingCapability = __webpack_exports__.XO;
|
|
771
806
|
export { __webpack_exports__Capability as Capability, __webpack_exports__PerformanceCapability as PerformanceCapability, __webpack_exports__TracingCapability as TracingCapability };
|
|
772
807
|
|
|
773
808
|
//# sourceMappingURL=index.js.map
|