@manifest-network/manifest-mcp-core 0.1.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/dist/__test-utils__/callTool.d.ts +29 -0
- package/dist/__test-utils__/callTool.d.ts.map +1 -0
- package/dist/__test-utils__/callTool.js +45 -0
- package/dist/__test-utils__/callTool.js.map +1 -0
- package/dist/__test-utils__/mocks.d.ts +125 -0
- package/dist/__test-utils__/mocks.d.ts.map +1 -0
- package/dist/__test-utils__/mocks.js +146 -0
- package/dist/__test-utils__/mocks.js.map +1 -0
- package/dist/client.d.ts +67 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +209 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +30 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +127 -0
- package/dist/config.js.map +1 -0
- package/dist/cosmos.d.ts +24 -0
- package/dist/cosmos.d.ts.map +1 -0
- package/dist/cosmos.js +85 -0
- package/dist/cosmos.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +20 -0
- package/dist/lcd-adapter.d.ts +15 -0
- package/dist/lcd-adapter.d.ts.map +1 -0
- package/dist/lcd-adapter.js +98 -0
- package/dist/lcd-adapter.js.map +1 -0
- package/dist/logger.d.ts +20 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +43 -0
- package/dist/logger.js.map +1 -0
- package/dist/modules.d.ts +63 -0
- package/dist/modules.d.ts.map +1 -0
- package/dist/modules.js +759 -0
- package/dist/modules.js.map +1 -0
- package/dist/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js +78 -0
- package/dist/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js.map +1 -0
- package/dist/node_modules/@vitest/expect/dist/index.d.ts +802 -0
- package/dist/node_modules/@vitest/expect/dist/index.d.ts.map +1 -0
- package/dist/node_modules/@vitest/expect/dist/index.js +1457 -0
- package/dist/node_modules/@vitest/expect/dist/index.js.map +1 -0
- package/dist/node_modules/@vitest/pretty-format/dist/index.d.ts +95 -0
- package/dist/node_modules/@vitest/pretty-format/dist/index.d.ts.map +1 -0
- package/dist/node_modules/@vitest/pretty-format/dist/index.js +877 -0
- package/dist/node_modules/@vitest/pretty-format/dist/index.js.map +1 -0
- package/dist/node_modules/@vitest/runner/dist/chunk-tasks.js +91 -0
- package/dist/node_modules/@vitest/runner/dist/chunk-tasks.js.map +1 -0
- package/dist/node_modules/@vitest/runner/dist/index.js +1381 -0
- package/dist/node_modules/@vitest/runner/dist/index.js.map +1 -0
- package/dist/node_modules/@vitest/runner/dist/tasks.d-D2GKpdwQ.d.ts +540 -0
- package/dist/node_modules/@vitest/runner/dist/tasks.d-D2GKpdwQ.d.ts.map +1 -0
- package/dist/node_modules/@vitest/runner/dist/utils.js +1 -0
- package/dist/node_modules/@vitest/snapshot/dist/environment.d-DOJxxZV9.d.ts +16 -0
- package/dist/node_modules/@vitest/snapshot/dist/environment.d-DOJxxZV9.d.ts.map +1 -0
- package/dist/node_modules/@vitest/snapshot/dist/index.d.ts +89 -0
- package/dist/node_modules/@vitest/snapshot/dist/index.d.ts.map +1 -0
- package/dist/node_modules/@vitest/snapshot/dist/index.js +649 -0
- package/dist/node_modules/@vitest/snapshot/dist/index.js.map +1 -0
- package/dist/node_modules/@vitest/snapshot/dist/rawSnapshot.d-U2kJUxDr.d.ts +40 -0
- package/dist/node_modules/@vitest/snapshot/dist/rawSnapshot.d-U2kJUxDr.d.ts.map +1 -0
- package/dist/node_modules/@vitest/spy/dist/index.d.ts +343 -0
- package/dist/node_modules/@vitest/spy/dist/index.d.ts.map +1 -0
- package/dist/node_modules/@vitest/spy/dist/index.js +386 -0
- package/dist/node_modules/@vitest/spy/dist/index.js.map +1 -0
- package/dist/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js +82 -0
- package/dist/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js.map +1 -0
- package/dist/node_modules/@vitest/utils/dist/diff.d.ts +14 -0
- package/dist/node_modules/@vitest/utils/dist/diff.d.ts.map +1 -0
- package/dist/node_modules/@vitest/utils/dist/diff.js +1297 -0
- package/dist/node_modules/@vitest/utils/dist/diff.js.map +1 -0
- package/dist/node_modules/@vitest/utils/dist/display.d.ts +15 -0
- package/dist/node_modules/@vitest/utils/dist/display.d.ts.map +1 -0
- package/dist/node_modules/@vitest/utils/dist/display.js +558 -0
- package/dist/node_modules/@vitest/utils/dist/display.js.map +1 -0
- package/dist/node_modules/@vitest/utils/dist/error.js +30 -0
- package/dist/node_modules/@vitest/utils/dist/error.js.map +1 -0
- package/dist/node_modules/@vitest/utils/dist/helpers.js +181 -0
- package/dist/node_modules/@vitest/utils/dist/helpers.js.map +1 -0
- package/dist/node_modules/@vitest/utils/dist/offset.js +27 -0
- package/dist/node_modules/@vitest/utils/dist/offset.js.map +1 -0
- package/dist/node_modules/@vitest/utils/dist/serialize.js +77 -0
- package/dist/node_modules/@vitest/utils/dist/serialize.js.map +1 -0
- package/dist/node_modules/@vitest/utils/dist/source-map.js +367 -0
- package/dist/node_modules/@vitest/utils/dist/source-map.js.map +1 -0
- package/dist/node_modules/@vitest/utils/dist/timers.js +37 -0
- package/dist/node_modules/@vitest/utils/dist/timers.js.map +1 -0
- package/dist/node_modules/@vitest/utils/dist/types.d-BCElaP-c.d.ts +38 -0
- package/dist/node_modules/@vitest/utils/dist/types.d-BCElaP-c.d.ts.map +1 -0
- package/dist/node_modules/@vitest/utils/dist/types.d.ts +25 -0
- package/dist/node_modules/@vitest/utils/dist/types.d.ts.map +1 -0
- package/dist/node_modules/chai/index.js +2875 -0
- package/dist/node_modules/chai/index.js.map +1 -0
- package/dist/node_modules/magic-string/dist/magic-string.es.js +939 -0
- package/dist/node_modules/magic-string/dist/magic-string.es.js.map +1 -0
- package/dist/node_modules/pathe/dist/shared/pathe.M-eThtNZ.js +85 -0
- package/dist/node_modules/pathe/dist/shared/pathe.M-eThtNZ.js.map +1 -0
- package/dist/node_modules/tinybench/dist/index.d.ts +91 -0
- package/dist/node_modules/tinybench/dist/index.d.ts.map +1 -0
- package/dist/node_modules/tinyrainbow/dist/index.d.ts +9 -0
- package/dist/node_modules/tinyrainbow/dist/index.d.ts.map +1 -0
- package/dist/node_modules/tinyrainbow/dist/index.js +86 -0
- package/dist/node_modules/tinyrainbow/dist/index.js.map +1 -0
- package/dist/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js +6 -0
- package/dist/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js.map +1 -0
- package/dist/node_modules/vitest/dist/chunks/benchmark.D0SlKNbZ.js +41 -0
- package/dist/node_modules/vitest/dist/chunks/benchmark.D0SlKNbZ.js.map +1 -0
- package/dist/node_modules/vitest/dist/chunks/benchmark.d.DAaHLpsq.d.ts +12 -0
- package/dist/node_modules/vitest/dist/chunks/benchmark.d.DAaHLpsq.d.ts.map +1 -0
- package/dist/node_modules/vitest/dist/chunks/global.d.x-ILCfAE.d.ts +100 -0
- package/dist/node_modules/vitest/dist/chunks/global.d.x-ILCfAE.d.ts.map +1 -0
- package/dist/node_modules/vitest/dist/chunks/rpc.MzXet3jl.js +57 -0
- package/dist/node_modules/vitest/dist/chunks/rpc.MzXet3jl.js.map +1 -0
- package/dist/node_modules/vitest/dist/chunks/rpc.d.BFMWpdph.d.ts +13 -0
- package/dist/node_modules/vitest/dist/chunks/rpc.d.BFMWpdph.d.ts.map +1 -0
- package/dist/node_modules/vitest/dist/chunks/test.CTcmp4Su.js +2791 -0
- package/dist/node_modules/vitest/dist/chunks/test.CTcmp4Su.js.map +1 -0
- package/dist/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.js +44 -0
- package/dist/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.js.map +1 -0
- package/dist/node_modules/vitest/dist/index.d.ts +9 -0
- package/dist/queries/auth.d.ts +15 -0
- package/dist/queries/auth.d.ts.map +1 -0
- package/dist/queries/auth.js +58 -0
- package/dist/queries/auth.js.map +1 -0
- package/dist/queries/bank.d.ts +15 -0
- package/dist/queries/bank.d.ts.map +1 -0
- package/dist/queries/bank.js +93 -0
- package/dist/queries/bank.js.map +1 -0
- package/dist/queries/billing.d.ts +15 -0
- package/dist/queries/billing.d.ts.map +1 -0
- package/dist/queries/billing.js +114 -0
- package/dist/queries/billing.js.map +1 -0
- package/dist/queries/distribution.d.ts +15 -0
- package/dist/queries/distribution.d.ts.map +1 -0
- package/dist/queries/distribution.js +73 -0
- package/dist/queries/distribution.js.map +1 -0
- package/dist/queries/gov.d.ts +15 -0
- package/dist/queries/gov.d.ts.map +1 -0
- package/dist/queries/gov.js +98 -0
- package/dist/queries/gov.js.map +1 -0
- package/dist/queries/group.d.ts +15 -0
- package/dist/queries/group.d.ts.map +1 -0
- package/dist/queries/group.js +159 -0
- package/dist/queries/group.js.map +1 -0
- package/dist/queries/index.d.ts +10 -0
- package/dist/queries/index.js +10 -0
- package/dist/queries/sku.d.ts +16 -0
- package/dist/queries/sku.d.ts.map +1 -0
- package/dist/queries/sku.js +85 -0
- package/dist/queries/sku.js.map +1 -0
- package/dist/queries/staking.d.ts +15 -0
- package/dist/queries/staking.d.ts.map +1 -0
- package/dist/queries/staking.js +127 -0
- package/dist/queries/staking.js.map +1 -0
- package/dist/queries/utils.d.ts +54 -0
- package/dist/queries/utils.d.ts.map +1 -0
- package/dist/queries/utils.js +74 -0
- package/dist/queries/utils.js.map +1 -0
- package/dist/retry.d.ts +48 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +106 -0
- package/dist/retry.js.map +1 -0
- package/dist/server-utils.d.ts +61 -0
- package/dist/server-utils.d.ts.map +1 -0
- package/dist/server-utils.js +156 -0
- package/dist/server-utils.js.map +1 -0
- package/dist/tools/fundCredits.d.ts +8 -0
- package/dist/tools/fundCredits.d.ts.map +1 -0
- package/dist/tools/fundCredits.js +9 -0
- package/dist/tools/fundCredits.js.map +1 -0
- package/dist/tools/getBalance.d.ts +26 -0
- package/dist/tools/getBalance.d.ts.map +1 -0
- package/dist/tools/getBalance.js +59 -0
- package/dist/tools/getBalance.js.map +1 -0
- package/dist/tools/stopApp.d.ts +13 -0
- package/dist/tools/stopApp.d.ts.map +1 -0
- package/dist/tools/stopApp.js +15 -0
- package/dist/tools/stopApp.js.map +1 -0
- package/dist/transactions/bank.d.ts +11 -0
- package/dist/transactions/bank.d.ts.map +1 -0
- package/dist/transactions/bank.js +75 -0
- package/dist/transactions/bank.js.map +1 -0
- package/dist/transactions/billing.d.ts +11 -0
- package/dist/transactions/billing.d.ts.map +1 -0
- package/dist/transactions/billing.js +189 -0
- package/dist/transactions/billing.js.map +1 -0
- package/dist/transactions/distribution.d.ts +11 -0
- package/dist/transactions/distribution.d.ts.map +1 -0
- package/dist/transactions/distribution.js +60 -0
- package/dist/transactions/distribution.js.map +1 -0
- package/dist/transactions/gov.d.ts +11 -0
- package/dist/transactions/gov.d.ts.map +1 -0
- package/dist/transactions/gov.js +108 -0
- package/dist/transactions/gov.js.map +1 -0
- package/dist/transactions/group.d.ts +11 -0
- package/dist/transactions/group.d.ts.map +1 -0
- package/dist/transactions/group.js +347 -0
- package/dist/transactions/group.js.map +1 -0
- package/dist/transactions/index.d.ts +10 -0
- package/dist/transactions/index.js +10 -0
- package/dist/transactions/manifest.d.ts +11 -0
- package/dist/transactions/manifest.d.ts.map +1 -0
- package/dist/transactions/manifest.js +59 -0
- package/dist/transactions/manifest.js.map +1 -0
- package/dist/transactions/sku.d.ts +11 -0
- package/dist/transactions/sku.d.ts.map +1 -0
- package/dist/transactions/sku.js +191 -0
- package/dist/transactions/sku.js.map +1 -0
- package/dist/transactions/staking.d.ts +11 -0
- package/dist/transactions/staking.d.ts.map +1 -0
- package/dist/transactions/staking.js +79 -0
- package/dist/transactions/staking.js.map +1 -0
- package/dist/transactions/utils.d.ts +161 -0
- package/dist/transactions/utils.d.ts.map +1 -0
- package/dist/transactions/utils.js +272 -0
- package/dist/transactions/utils.js.map +1 -0
- package/dist/types.d.ts +390 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +45 -0
- package/dist/types.js.map +1 -0
- package/dist/validation.d.ts +30 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +53 -0
- package/dist/validation.js.map +1 -0
- package/dist/version.d.ts +5 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/dist/wallet/index.d.ts +4 -0
- package/dist/wallet/index.js +3 -0
- package/dist/wallet/mnemonic.d.ts +47 -0
- package/dist/wallet/mnemonic.d.ts.map +1 -0
- package/dist/wallet/mnemonic.js +97 -0
- package/dist/wallet/mnemonic.js.map +1 -0
- package/dist/wallet/sign-arbitrary.d.ts +12 -0
- package/dist/wallet/sign-arbitrary.d.ts.map +1 -0
- package/dist/wallet/sign-arbitrary.js +36 -0
- package/dist/wallet/sign-arbitrary.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
//#region ../../node_modules/@vitest/spy/dist/index.js
|
|
2
|
+
function isMockFunction(fn) {
|
|
3
|
+
return typeof fn === "function" && "_isMockFunction" in fn && fn._isMockFunction === true;
|
|
4
|
+
}
|
|
5
|
+
const MOCK_RESTORE = /* @__PURE__ */ new Set();
|
|
6
|
+
const REGISTERED_MOCKS = /* @__PURE__ */ new Set();
|
|
7
|
+
const MOCK_CONFIGS = /* @__PURE__ */ new WeakMap();
|
|
8
|
+
function createMockInstance(options = {}) {
|
|
9
|
+
const { originalImplementation, restore, mockImplementation, resetToMockImplementation, resetToMockName } = options;
|
|
10
|
+
if (restore) MOCK_RESTORE.add(restore);
|
|
11
|
+
const config = getDefaultConfig(originalImplementation);
|
|
12
|
+
const state = getDefaultState();
|
|
13
|
+
const mock = createMock({
|
|
14
|
+
config,
|
|
15
|
+
state,
|
|
16
|
+
...options
|
|
17
|
+
});
|
|
18
|
+
const mockLength = (mockImplementation || originalImplementation)?.length ?? 0;
|
|
19
|
+
Object.defineProperty(mock, "length", {
|
|
20
|
+
writable: true,
|
|
21
|
+
enumerable: false,
|
|
22
|
+
value: mockLength,
|
|
23
|
+
configurable: true
|
|
24
|
+
});
|
|
25
|
+
if (resetToMockName) config.mockName = mock.name || "vi.fn()";
|
|
26
|
+
MOCK_CONFIGS.set(mock, config);
|
|
27
|
+
REGISTERED_MOCKS.add(mock);
|
|
28
|
+
mock._isMockFunction = true;
|
|
29
|
+
mock.getMockImplementation = () => {
|
|
30
|
+
return config.onceMockImplementations[0] || config.mockImplementation;
|
|
31
|
+
};
|
|
32
|
+
Object.defineProperty(mock, "mock", {
|
|
33
|
+
configurable: false,
|
|
34
|
+
enumerable: true,
|
|
35
|
+
writable: false,
|
|
36
|
+
value: state
|
|
37
|
+
});
|
|
38
|
+
mock.mockImplementation = function mockImplementation(implementation) {
|
|
39
|
+
config.mockImplementation = implementation;
|
|
40
|
+
return mock;
|
|
41
|
+
};
|
|
42
|
+
mock.mockImplementationOnce = function mockImplementationOnce(implementation) {
|
|
43
|
+
config.onceMockImplementations.push(implementation);
|
|
44
|
+
return mock;
|
|
45
|
+
};
|
|
46
|
+
mock.withImplementation = function withImplementation(implementation, callback) {
|
|
47
|
+
const previousImplementation = config.mockImplementation;
|
|
48
|
+
const previousOnceImplementations = config.onceMockImplementations;
|
|
49
|
+
const reset = () => {
|
|
50
|
+
config.mockImplementation = previousImplementation;
|
|
51
|
+
config.onceMockImplementations = previousOnceImplementations;
|
|
52
|
+
};
|
|
53
|
+
config.mockImplementation = implementation;
|
|
54
|
+
config.onceMockImplementations = [];
|
|
55
|
+
const returnValue = callback();
|
|
56
|
+
if (typeof returnValue === "object" && typeof returnValue?.then === "function") return returnValue.then(() => {
|
|
57
|
+
reset();
|
|
58
|
+
return mock;
|
|
59
|
+
});
|
|
60
|
+
else reset();
|
|
61
|
+
return mock;
|
|
62
|
+
};
|
|
63
|
+
mock.mockReturnThis = function mockReturnThis() {
|
|
64
|
+
return mock.mockImplementation(function() {
|
|
65
|
+
return this;
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
mock.mockReturnValue = function mockReturnValue(value) {
|
|
69
|
+
return mock.mockImplementation(function() {
|
|
70
|
+
if (new.target) throwConstructorError("mockReturnValue");
|
|
71
|
+
return value;
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
mock.mockReturnValueOnce = function mockReturnValueOnce(value) {
|
|
75
|
+
return mock.mockImplementationOnce(function() {
|
|
76
|
+
if (new.target) throwConstructorError("mockReturnValueOnce");
|
|
77
|
+
return value;
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
mock.mockThrow = function mockThrow(value) {
|
|
81
|
+
return mock.mockImplementation(function() {
|
|
82
|
+
throw value;
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
mock.mockThrowOnce = function mockThrowOnce(value) {
|
|
86
|
+
return mock.mockImplementationOnce(function() {
|
|
87
|
+
throw value;
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
mock.mockResolvedValue = function mockResolvedValue(value) {
|
|
91
|
+
return mock.mockImplementation(function() {
|
|
92
|
+
if (new.target) throwConstructorError("mockResolvedValue");
|
|
93
|
+
return Promise.resolve(value);
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
mock.mockResolvedValueOnce = function mockResolvedValueOnce(value) {
|
|
97
|
+
return mock.mockImplementationOnce(function() {
|
|
98
|
+
if (new.target) throwConstructorError("mockResolvedValueOnce");
|
|
99
|
+
return Promise.resolve(value);
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
mock.mockRejectedValue = function mockRejectedValue(value) {
|
|
103
|
+
return mock.mockImplementation(function() {
|
|
104
|
+
if (new.target) throwConstructorError("mockRejectedValue");
|
|
105
|
+
return Promise.reject(value);
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
mock.mockRejectedValueOnce = function mockRejectedValueOnce(value) {
|
|
109
|
+
return mock.mockImplementationOnce(function() {
|
|
110
|
+
if (new.target) throwConstructorError("mockRejectedValueOnce");
|
|
111
|
+
return Promise.reject(value);
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
mock.mockClear = function mockClear() {
|
|
115
|
+
state.calls = [];
|
|
116
|
+
state.contexts = [];
|
|
117
|
+
state.instances = [];
|
|
118
|
+
state.invocationCallOrder = [];
|
|
119
|
+
state.results = [];
|
|
120
|
+
state.settledResults = [];
|
|
121
|
+
return mock;
|
|
122
|
+
};
|
|
123
|
+
mock.mockReset = function mockReset() {
|
|
124
|
+
mock.mockClear();
|
|
125
|
+
config.mockImplementation = resetToMockImplementation ? mockImplementation : void 0;
|
|
126
|
+
config.mockName = resetToMockName ? mock.name || "vi.fn()" : "vi.fn()";
|
|
127
|
+
config.onceMockImplementations = [];
|
|
128
|
+
return mock;
|
|
129
|
+
};
|
|
130
|
+
mock.mockRestore = function mockRestore() {
|
|
131
|
+
mock.mockReset();
|
|
132
|
+
return restore?.();
|
|
133
|
+
};
|
|
134
|
+
mock.mockName = function mockName(name) {
|
|
135
|
+
if (typeof name === "string") config.mockName = name;
|
|
136
|
+
return mock;
|
|
137
|
+
};
|
|
138
|
+
mock.getMockName = function getMockName() {
|
|
139
|
+
return config.mockName || "vi.fn()";
|
|
140
|
+
};
|
|
141
|
+
if (Symbol.dispose) mock[Symbol.dispose] = () => mock.mockRestore();
|
|
142
|
+
if (mockImplementation) mock.mockImplementation(mockImplementation);
|
|
143
|
+
return mock;
|
|
144
|
+
}
|
|
145
|
+
function fn(originalImplementation) {
|
|
146
|
+
if (originalImplementation != null && isMockFunction(originalImplementation)) return originalImplementation;
|
|
147
|
+
return createMockInstance({
|
|
148
|
+
mockImplementation: originalImplementation,
|
|
149
|
+
resetToMockImplementation: true
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function spyOn(object, key, accessor) {
|
|
153
|
+
assert(object != null, "The vi.spyOn() function could not find an object to spy upon. The first argument must be defined.");
|
|
154
|
+
assert(typeof object === "object" || typeof object === "function", "Vitest cannot spy on a primitive value.");
|
|
155
|
+
const [originalDescriptorObject, originalDescriptor] = getDescriptor(object, key) || [];
|
|
156
|
+
assert(originalDescriptor || key in object, `The property "${String(key)}" is not defined on the ${typeof object}.`);
|
|
157
|
+
let accessType = accessor || "value";
|
|
158
|
+
let ssr = false;
|
|
159
|
+
if (accessType === "value" && originalDescriptor && originalDescriptor.value == null && originalDescriptor.get) {
|
|
160
|
+
accessType = "get";
|
|
161
|
+
ssr = true;
|
|
162
|
+
}
|
|
163
|
+
let original;
|
|
164
|
+
if (originalDescriptor) {
|
|
165
|
+
original = originalDescriptor[accessType];
|
|
166
|
+
if (original == null && accessType === "value") original = object[key];
|
|
167
|
+
} else if (accessType !== "value") original = () => object[key];
|
|
168
|
+
else original = object[key];
|
|
169
|
+
const originalImplementation = ssr && original ? original() : original;
|
|
170
|
+
const originalType = typeof originalImplementation;
|
|
171
|
+
assert(originalType === "function" || accessType !== "value" && original == null, `vi.spyOn() can only spy on a function. Received ${originalType}.`);
|
|
172
|
+
if (isMockFunction(originalImplementation)) return originalImplementation;
|
|
173
|
+
const reassign = (cb) => {
|
|
174
|
+
const { value, ...desc } = originalDescriptor || {
|
|
175
|
+
configurable: true,
|
|
176
|
+
writable: true
|
|
177
|
+
};
|
|
178
|
+
if (accessType !== "value") delete desc.writable;
|
|
179
|
+
desc[accessType] = cb;
|
|
180
|
+
Object.defineProperty(object, key, desc);
|
|
181
|
+
};
|
|
182
|
+
const restore = () => {
|
|
183
|
+
if (originalDescriptorObject !== object) Reflect.deleteProperty(object, key);
|
|
184
|
+
else if (originalDescriptor && !original) Object.defineProperty(object, key, originalDescriptor);
|
|
185
|
+
else reassign(original);
|
|
186
|
+
};
|
|
187
|
+
const mock = createMockInstance({
|
|
188
|
+
restore,
|
|
189
|
+
originalImplementation,
|
|
190
|
+
resetToMockName: true
|
|
191
|
+
});
|
|
192
|
+
try {
|
|
193
|
+
reassign(ssr ? () => mock : mock);
|
|
194
|
+
} catch (error) {
|
|
195
|
+
if (error instanceof TypeError && Symbol.toStringTag && object[Symbol.toStringTag] === "Module" && (error.message.includes("Cannot redefine property") || error.message.includes("Cannot replace module namespace") || error.message.includes("can't redefine non-configurable property"))) throw new TypeError(`Cannot spy on export "${String(key)}". Module namespace is not configurable in ESM. See: https://vitest.dev/guide/browser/#limitations`, { cause: error });
|
|
196
|
+
throw error;
|
|
197
|
+
}
|
|
198
|
+
return mock;
|
|
199
|
+
}
|
|
200
|
+
function getDescriptor(obj, method) {
|
|
201
|
+
const objDescriptor = Object.getOwnPropertyDescriptor(obj, method);
|
|
202
|
+
if (objDescriptor) return [obj, objDescriptor];
|
|
203
|
+
let currentProto = Object.getPrototypeOf(obj);
|
|
204
|
+
while (currentProto !== null) {
|
|
205
|
+
const descriptor = Object.getOwnPropertyDescriptor(currentProto, method);
|
|
206
|
+
if (descriptor) return [currentProto, descriptor];
|
|
207
|
+
currentProto = Object.getPrototypeOf(currentProto);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
function assert(condition, message) {
|
|
211
|
+
if (!condition) throw new Error(message);
|
|
212
|
+
}
|
|
213
|
+
let invocationCallCounter = 1;
|
|
214
|
+
function createMock({ state, config, name: mockName, prototypeState, prototypeConfig, keepMembersImplementation, mockImplementation, prototypeMembers = [] }) {
|
|
215
|
+
const original = config.mockOriginal;
|
|
216
|
+
const pseudoOriginal = mockImplementation;
|
|
217
|
+
const name = mockName || original?.name || "Mock";
|
|
218
|
+
const namedObject = { [name]: (function(...args) {
|
|
219
|
+
registerCalls(args, state, prototypeState);
|
|
220
|
+
registerInvocationOrder(invocationCallCounter++, state, prototypeState);
|
|
221
|
+
const result = {
|
|
222
|
+
type: "incomplete",
|
|
223
|
+
value: void 0
|
|
224
|
+
};
|
|
225
|
+
const settledResult = {
|
|
226
|
+
type: "incomplete",
|
|
227
|
+
value: void 0
|
|
228
|
+
};
|
|
229
|
+
registerResult(result, state, prototypeState);
|
|
230
|
+
registerSettledResult(settledResult, state, prototypeState);
|
|
231
|
+
const context = new.target ? void 0 : this;
|
|
232
|
+
const [instanceIndex, instancePrototypeIndex] = registerInstance(context, state, prototypeState);
|
|
233
|
+
const [contextIndex, contextPrototypeIndex] = registerContext(context, state, prototypeState);
|
|
234
|
+
const implementation = config.onceMockImplementations.shift() || config.mockImplementation || prototypeConfig?.onceMockImplementations.shift() || prototypeConfig?.mockImplementation || original || function() {};
|
|
235
|
+
let returnValue;
|
|
236
|
+
let thrownValue;
|
|
237
|
+
let didThrow = false;
|
|
238
|
+
try {
|
|
239
|
+
if (new.target) {
|
|
240
|
+
returnValue = Reflect.construct(implementation, args, new.target);
|
|
241
|
+
for (const prop of prototypeMembers) {
|
|
242
|
+
const prototypeMock = returnValue[prop];
|
|
243
|
+
if (prototypeMock !== mock.prototype[prop]) continue;
|
|
244
|
+
const isMock = isMockFunction(prototypeMock);
|
|
245
|
+
const prototypeState = isMock ? prototypeMock.mock : void 0;
|
|
246
|
+
const prototypeConfig = isMock ? MOCK_CONFIGS.get(prototypeMock) : void 0;
|
|
247
|
+
returnValue[prop] = createMockInstance({
|
|
248
|
+
originalImplementation: keepMembersImplementation ? prototypeConfig?.mockOriginal : void 0,
|
|
249
|
+
prototypeState,
|
|
250
|
+
prototypeConfig,
|
|
251
|
+
keepMembersImplementation
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
} else returnValue = implementation.apply(this, args);
|
|
255
|
+
} catch (error) {
|
|
256
|
+
thrownValue = error;
|
|
257
|
+
didThrow = true;
|
|
258
|
+
if (error instanceof TypeError && error.message.includes("is not a constructor")) console.warn(`[vitest] The ${namedObject[name].getMockName()} mock did not use 'function' or 'class' in its implementation, see https://vitest.dev/api/vi#vi-spyon for examples.`);
|
|
259
|
+
throw error;
|
|
260
|
+
} finally {
|
|
261
|
+
if (didThrow) {
|
|
262
|
+
result.type = "throw";
|
|
263
|
+
result.value = thrownValue;
|
|
264
|
+
settledResult.type = "rejected";
|
|
265
|
+
settledResult.value = thrownValue;
|
|
266
|
+
} else {
|
|
267
|
+
result.type = "return";
|
|
268
|
+
result.value = returnValue;
|
|
269
|
+
if (new.target) {
|
|
270
|
+
state.contexts[contextIndex - 1] = returnValue;
|
|
271
|
+
state.instances[instanceIndex - 1] = returnValue;
|
|
272
|
+
if (contextPrototypeIndex != null && prototypeState) prototypeState.contexts[contextPrototypeIndex - 1] = returnValue;
|
|
273
|
+
if (instancePrototypeIndex != null && prototypeState) prototypeState.instances[instancePrototypeIndex - 1] = returnValue;
|
|
274
|
+
}
|
|
275
|
+
if (returnValue instanceof Promise) returnValue.then((settledValue) => {
|
|
276
|
+
settledResult.type = "fulfilled";
|
|
277
|
+
settledResult.value = settledValue;
|
|
278
|
+
}, (rejectedValue) => {
|
|
279
|
+
settledResult.type = "rejected";
|
|
280
|
+
settledResult.value = rejectedValue;
|
|
281
|
+
});
|
|
282
|
+
else {
|
|
283
|
+
settledResult.type = "fulfilled";
|
|
284
|
+
settledResult.value = returnValue;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return returnValue;
|
|
289
|
+
}) };
|
|
290
|
+
const mock = namedObject[name];
|
|
291
|
+
const copyPropertiesFrom = original || pseudoOriginal;
|
|
292
|
+
if (copyPropertiesFrom) copyOriginalStaticProperties(mock, copyPropertiesFrom);
|
|
293
|
+
return mock;
|
|
294
|
+
}
|
|
295
|
+
function registerCalls(args, state, prototypeState) {
|
|
296
|
+
state.calls.push(args);
|
|
297
|
+
prototypeState?.calls.push(args);
|
|
298
|
+
}
|
|
299
|
+
function registerInvocationOrder(order, state, prototypeState) {
|
|
300
|
+
state.invocationCallOrder.push(order);
|
|
301
|
+
prototypeState?.invocationCallOrder.push(order);
|
|
302
|
+
}
|
|
303
|
+
function registerResult(result, state, prototypeState) {
|
|
304
|
+
state.results.push(result);
|
|
305
|
+
prototypeState?.results.push(result);
|
|
306
|
+
}
|
|
307
|
+
function registerSettledResult(result, state, prototypeState) {
|
|
308
|
+
state.settledResults.push(result);
|
|
309
|
+
prototypeState?.settledResults.push(result);
|
|
310
|
+
}
|
|
311
|
+
function registerInstance(instance, state, prototypeState) {
|
|
312
|
+
return [state.instances.push(instance), prototypeState?.instances.push(instance)];
|
|
313
|
+
}
|
|
314
|
+
function registerContext(context, state, prototypeState) {
|
|
315
|
+
return [state.contexts.push(context), prototypeState?.contexts.push(context)];
|
|
316
|
+
}
|
|
317
|
+
function copyOriginalStaticProperties(mock, original) {
|
|
318
|
+
const { properties, descriptors } = getAllProperties(original);
|
|
319
|
+
for (const key of properties) {
|
|
320
|
+
const descriptor = descriptors[key];
|
|
321
|
+
if (getDescriptor(mock, key)) continue;
|
|
322
|
+
Object.defineProperty(mock, key, descriptor);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
const ignoreProperties = new Set([
|
|
326
|
+
"length",
|
|
327
|
+
"name",
|
|
328
|
+
"prototype",
|
|
329
|
+
Symbol.for("nodejs.util.promisify.custom")
|
|
330
|
+
]);
|
|
331
|
+
function getAllProperties(original) {
|
|
332
|
+
const properties = /* @__PURE__ */ new Set();
|
|
333
|
+
const descriptors = {};
|
|
334
|
+
while (original && original !== Object.prototype && original !== Function.prototype) {
|
|
335
|
+
const ownProperties = [...Object.getOwnPropertyNames(original), ...Object.getOwnPropertySymbols(original)];
|
|
336
|
+
for (const prop of ownProperties) {
|
|
337
|
+
if (descriptors[prop] || ignoreProperties.has(prop)) continue;
|
|
338
|
+
properties.add(prop);
|
|
339
|
+
descriptors[prop] = Object.getOwnPropertyDescriptor(original, prop);
|
|
340
|
+
}
|
|
341
|
+
original = Object.getPrototypeOf(original);
|
|
342
|
+
}
|
|
343
|
+
return {
|
|
344
|
+
properties,
|
|
345
|
+
descriptors
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
function getDefaultConfig(original) {
|
|
349
|
+
return {
|
|
350
|
+
mockImplementation: void 0,
|
|
351
|
+
mockOriginal: original,
|
|
352
|
+
mockName: "vi.fn()",
|
|
353
|
+
onceMockImplementations: []
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
function getDefaultState() {
|
|
357
|
+
const state = {
|
|
358
|
+
calls: [],
|
|
359
|
+
contexts: [],
|
|
360
|
+
instances: [],
|
|
361
|
+
invocationCallOrder: [],
|
|
362
|
+
settledResults: [],
|
|
363
|
+
results: [],
|
|
364
|
+
get lastCall() {
|
|
365
|
+
return state.calls.at(-1);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
return state;
|
|
369
|
+
}
|
|
370
|
+
function restoreAllMocks() {
|
|
371
|
+
for (const restore of MOCK_RESTORE) restore();
|
|
372
|
+
MOCK_RESTORE.clear();
|
|
373
|
+
}
|
|
374
|
+
function clearAllMocks() {
|
|
375
|
+
REGISTERED_MOCKS.forEach((mock) => mock.mockClear());
|
|
376
|
+
}
|
|
377
|
+
function resetAllMocks() {
|
|
378
|
+
REGISTERED_MOCKS.forEach((mock) => mock.mockReset());
|
|
379
|
+
}
|
|
380
|
+
function throwConstructorError(shorthand) {
|
|
381
|
+
throw new TypeError(`Cannot use \`${shorthand}\` when called with \`new\`. Use \`mockImplementation\` with a \`class\` keyword instead. See https://vitest.dev/api/mock#class-support for more information.`);
|
|
382
|
+
}
|
|
383
|
+
//#endregion
|
|
384
|
+
export { clearAllMocks, fn, isMockFunction, resetAllMocks, restoreAllMocks, spyOn };
|
|
385
|
+
|
|
386
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../../node_modules/@vitest/spy/dist/index.js"],"sourcesContent":["function isMockFunction(fn) {\n\treturn typeof fn === \"function\" && \"_isMockFunction\" in fn && fn._isMockFunction === true;\n}\nconst MOCK_RESTORE = new Set();\n// Jest keeps the state in a separate WeakMap which is good for memory,\n// but it makes the state slower to access and return different values\n// if you stored it before calling `mockClear` where it will be recreated\nconst REGISTERED_MOCKS = new Set();\nconst MOCK_CONFIGS = new WeakMap();\nfunction createMockInstance(options = {}) {\n\tconst { originalImplementation, restore, mockImplementation, resetToMockImplementation, resetToMockName } = options;\n\tif (restore) {\n\t\tMOCK_RESTORE.add(restore);\n\t}\n\tconst config = getDefaultConfig(originalImplementation);\n\tconst state = getDefaultState();\n\tconst mock = createMock({\n\t\tconfig,\n\t\tstate,\n\t\t...options\n\t});\n\tconst mockLength = (mockImplementation || originalImplementation)?.length ?? 0;\n\tObject.defineProperty(mock, \"length\", {\n\t\twritable: true,\n\t\tenumerable: false,\n\t\tvalue: mockLength,\n\t\tconfigurable: true\n\t});\n\t// inherit the default name so it appears in snapshots and logs\n\t// this is used by `vi.spyOn()` for better debugging.\n\t// when `vi.fn()` is called, we just use the default string\n\tif (resetToMockName) {\n\t\tconfig.mockName = mock.name || \"vi.fn()\";\n\t}\n\tMOCK_CONFIGS.set(mock, config);\n\tREGISTERED_MOCKS.add(mock);\n\tmock._isMockFunction = true;\n\tmock.getMockImplementation = () => {\n\t\t// Jest only returns `config.mockImplementation` here,\n\t\t// but we think it makes sense to return what the next function will be called\n\t\treturn config.onceMockImplementations[0] || config.mockImplementation;\n\t};\n\tObject.defineProperty(mock, \"mock\", {\n\t\tconfigurable: false,\n\t\tenumerable: true,\n\t\twritable: false,\n\t\tvalue: state\n\t});\n\tmock.mockImplementation = function mockImplementation(implementation) {\n\t\tconfig.mockImplementation = implementation;\n\t\treturn mock;\n\t};\n\tmock.mockImplementationOnce = function mockImplementationOnce(implementation) {\n\t\tconfig.onceMockImplementations.push(implementation);\n\t\treturn mock;\n\t};\n\tmock.withImplementation = function withImplementation(implementation, callback) {\n\t\tconst previousImplementation = config.mockImplementation;\n\t\tconst previousOnceImplementations = config.onceMockImplementations;\n\t\tconst reset = () => {\n\t\t\tconfig.mockImplementation = previousImplementation;\n\t\t\tconfig.onceMockImplementations = previousOnceImplementations;\n\t\t};\n\t\tconfig.mockImplementation = implementation;\n\t\tconfig.onceMockImplementations = [];\n\t\tconst returnValue = callback();\n\t\tif (typeof returnValue === \"object\" && typeof returnValue?.then === \"function\") {\n\t\t\treturn returnValue.then(() => {\n\t\t\t\treset();\n\t\t\t\treturn mock;\n\t\t\t});\n\t\t} else {\n\t\t\treset();\n\t\t}\n\t\treturn mock;\n\t};\n\tmock.mockReturnThis = function mockReturnThis() {\n\t\treturn mock.mockImplementation(function() {\n\t\t\treturn this;\n\t\t});\n\t};\n\tmock.mockReturnValue = function mockReturnValue(value) {\n\t\treturn mock.mockImplementation(function() {\n\t\t\tif (new.target) {\n\t\t\t\tthrowConstructorError(\"mockReturnValue\");\n\t\t\t}\n\t\t\treturn value;\n\t\t});\n\t};\n\tmock.mockReturnValueOnce = function mockReturnValueOnce(value) {\n\t\treturn mock.mockImplementationOnce(function() {\n\t\t\tif (new.target) {\n\t\t\t\tthrowConstructorError(\"mockReturnValueOnce\");\n\t\t\t}\n\t\t\treturn value;\n\t\t});\n\t};\n\tmock.mockThrow = function mockThrow(value) {\n\t\t// eslint-disable-next-line prefer-arrow-callback\n\t\treturn mock.mockImplementation(function() {\n\t\t\tthrow value;\n\t\t});\n\t};\n\tmock.mockThrowOnce = function mockThrowOnce(value) {\n\t\t// eslint-disable-next-line prefer-arrow-callback\n\t\treturn mock.mockImplementationOnce(function() {\n\t\t\tthrow value;\n\t\t});\n\t};\n\tmock.mockResolvedValue = function mockResolvedValue(value) {\n\t\treturn mock.mockImplementation(function() {\n\t\t\tif (new.target) {\n\t\t\t\tthrowConstructorError(\"mockResolvedValue\");\n\t\t\t}\n\t\t\treturn Promise.resolve(value);\n\t\t});\n\t};\n\tmock.mockResolvedValueOnce = function mockResolvedValueOnce(value) {\n\t\treturn mock.mockImplementationOnce(function() {\n\t\t\tif (new.target) {\n\t\t\t\tthrowConstructorError(\"mockResolvedValueOnce\");\n\t\t\t}\n\t\t\treturn Promise.resolve(value);\n\t\t});\n\t};\n\tmock.mockRejectedValue = function mockRejectedValue(value) {\n\t\treturn mock.mockImplementation(function() {\n\t\t\tif (new.target) {\n\t\t\t\tthrowConstructorError(\"mockRejectedValue\");\n\t\t\t}\n\t\t\treturn Promise.reject(value);\n\t\t});\n\t};\n\tmock.mockRejectedValueOnce = function mockRejectedValueOnce(value) {\n\t\treturn mock.mockImplementationOnce(function() {\n\t\t\tif (new.target) {\n\t\t\t\tthrowConstructorError(\"mockRejectedValueOnce\");\n\t\t\t}\n\t\t\treturn Promise.reject(value);\n\t\t});\n\t};\n\tmock.mockClear = function mockClear() {\n\t\tstate.calls = [];\n\t\tstate.contexts = [];\n\t\tstate.instances = [];\n\t\tstate.invocationCallOrder = [];\n\t\tstate.results = [];\n\t\tstate.settledResults = [];\n\t\treturn mock;\n\t};\n\tmock.mockReset = function mockReset() {\n\t\tmock.mockClear();\n\t\tconfig.mockImplementation = resetToMockImplementation ? mockImplementation : undefined;\n\t\tconfig.mockName = resetToMockName ? mock.name || \"vi.fn()\" : \"vi.fn()\";\n\t\tconfig.onceMockImplementations = [];\n\t\treturn mock;\n\t};\n\tmock.mockRestore = function mockRestore() {\n\t\tmock.mockReset();\n\t\treturn restore?.();\n\t};\n\tmock.mockName = function mockName(name) {\n\t\tif (typeof name === \"string\") {\n\t\t\tconfig.mockName = name;\n\t\t}\n\t\treturn mock;\n\t};\n\tmock.getMockName = function getMockName() {\n\t\treturn config.mockName || \"vi.fn()\";\n\t};\n\tif (Symbol.dispose) {\n\t\tmock[Symbol.dispose] = () => mock.mockRestore();\n\t}\n\tif (mockImplementation) {\n\t\tmock.mockImplementation(mockImplementation);\n\t}\n\treturn mock;\n}\nfunction fn(originalImplementation) {\n\t// if the function is already a mock, just return the same function,\n\t// simillarly to how vi.spyOn() works\n\tif (originalImplementation != null && isMockFunction(originalImplementation)) {\n\t\treturn originalImplementation;\n\t}\n\treturn createMockInstance({\n\t\tmockImplementation: originalImplementation,\n\t\tresetToMockImplementation: true\n\t});\n}\nfunction spyOn(object, key, accessor) {\n\tassert(object != null, \"The vi.spyOn() function could not find an object to spy upon. The first argument must be defined.\");\n\tassert(typeof object === \"object\" || typeof object === \"function\", \"Vitest cannot spy on a primitive value.\");\n\tconst [originalDescriptorObject, originalDescriptor] = getDescriptor(object, key) || [];\n\tassert(originalDescriptor || key in object, `The property \"${String(key)}\" is not defined on the ${typeof object}.`);\n\tlet accessType = accessor || \"value\";\n\tlet ssr = false;\n\t// vite ssr support - actual function is stored inside a getter\n\tif (accessType === \"value\" && originalDescriptor && originalDescriptor.value == null && originalDescriptor.get) {\n\t\taccessType = \"get\";\n\t\tssr = true;\n\t}\n\tlet original;\n\tif (originalDescriptor) {\n\t\toriginal = originalDescriptor[accessType];\n\t\t// weird Proxy edge case where descriptor's value is undefined,\n\t\t// but there's still a value on the object when called\n\t\t// https://github.com/vitest-dev/vitest/issues/9439\n\t\tif (original == null && accessType === \"value\") {\n\t\t\toriginal = object[key];\n\t\t}\n\t} else if (accessType !== \"value\") {\n\t\toriginal = () => object[key];\n\t} else {\n\t\toriginal = object[key];\n\t}\n\tconst originalImplementation = ssr && original ? original() : original;\n\tconst originalType = typeof originalImplementation;\n\tassert(\n\t\t// allow only functions\n\t\toriginalType === \"function\" || accessType !== \"value\" && original == null,\n\t\t`vi.spyOn() can only spy on a function. Received ${originalType}.`\n\t);\n\tif (isMockFunction(originalImplementation)) {\n\t\treturn originalImplementation;\n\t}\n\tconst reassign = (cb) => {\n\t\tconst { value, ...desc } = originalDescriptor || {\n\t\t\tconfigurable: true,\n\t\t\twritable: true\n\t\t};\n\t\tif (accessType !== \"value\") {\n\t\t\tdelete desc.writable;\n\t\t}\n\t\tdesc[accessType] = cb;\n\t\tObject.defineProperty(object, key, desc);\n\t};\n\tconst restore = () => {\n\t\t// if method is defined on the prototype, we can just remove it from\n\t\t// the current object instead of redefining a copy of it\n\t\tif (originalDescriptorObject !== object) {\n\t\t\tReflect.deleteProperty(object, key);\n\t\t} else if (originalDescriptor && !original) {\n\t\t\tObject.defineProperty(object, key, originalDescriptor);\n\t\t} else {\n\t\t\treassign(original);\n\t\t}\n\t};\n\tconst mock = createMockInstance({\n\t\trestore,\n\t\toriginalImplementation,\n\t\tresetToMockName: true\n\t});\n\ttry {\n\t\treassign(ssr ? () => mock : mock);\n\t} catch (error) {\n\t\tif (error instanceof TypeError && Symbol.toStringTag && object[Symbol.toStringTag] === \"Module\" && (error.message.includes(\"Cannot redefine property\") || error.message.includes(\"Cannot replace module namespace\") || error.message.includes(\"can't redefine non-configurable property\"))) {\n\t\t\tthrow new TypeError(`Cannot spy on export \"${String(key)}\". Module namespace is not configurable in ESM. See: https://vitest.dev/guide/browser/#limitations`, { cause: error });\n\t\t}\n\t\tthrow error;\n\t}\n\treturn mock;\n}\nfunction getDescriptor(obj, method) {\n\tconst objDescriptor = Object.getOwnPropertyDescriptor(obj, method);\n\tif (objDescriptor) {\n\t\treturn [obj, objDescriptor];\n\t}\n\tlet currentProto = Object.getPrototypeOf(obj);\n\twhile (currentProto !== null) {\n\t\tconst descriptor = Object.getOwnPropertyDescriptor(currentProto, method);\n\t\tif (descriptor) {\n\t\t\treturn [currentProto, descriptor];\n\t\t}\n\t\tcurrentProto = Object.getPrototypeOf(currentProto);\n\t}\n}\nfunction assert(condition, message) {\n\tif (!condition) {\n\t\tthrow new Error(message);\n\t}\n}\nlet invocationCallCounter = 1;\nfunction createMock({ state, config, name: mockName, prototypeState, prototypeConfig, keepMembersImplementation, mockImplementation, prototypeMembers = [] }) {\n\tconst original = config.mockOriginal;\n\tconst pseudoOriginal = mockImplementation;\n\tconst name = mockName || original?.name || \"Mock\";\n\tconst namedObject = { [name]: (function(...args) {\n\t\tregisterCalls(args, state, prototypeState);\n\t\tregisterInvocationOrder(invocationCallCounter++, state, prototypeState);\n\t\tconst result = {\n\t\t\ttype: \"incomplete\",\n\t\t\tvalue: undefined\n\t\t};\n\t\tconst settledResult = {\n\t\t\ttype: \"incomplete\",\n\t\t\tvalue: undefined\n\t\t};\n\t\tregisterResult(result, state, prototypeState);\n\t\tregisterSettledResult(settledResult, state, prototypeState);\n\t\tconst context = new.target ? undefined : this;\n\t\tconst [instanceIndex, instancePrototypeIndex] = registerInstance(context, state, prototypeState);\n\t\tconst [contextIndex, contextPrototypeIndex] = registerContext(context, state, prototypeState);\n\t\tconst implementation = config.onceMockImplementations.shift() || config.mockImplementation || prototypeConfig?.onceMockImplementations.shift() || prototypeConfig?.mockImplementation || original || function() {};\n\t\tlet returnValue;\n\t\tlet thrownValue;\n\t\tlet didThrow = false;\n\t\ttry {\n\t\t\tif (new.target) {\n\t\t\t\treturnValue = Reflect.construct(implementation, args, new.target);\n\t\t\t\t// jest calls this before the implementation, but we have to resolve this _after_\n\t\t\t\t// because we cannot do it before the `Reflect.construct` called the custom implementation.\n\t\t\t\t// fortunetly, the constructor is always an empty functon because `prototypeMethods`\n\t\t\t\t// are only used by the automocker, so this doesn't matter\n\t\t\t\tfor (const prop of prototypeMembers) {\n\t\t\t\t\tconst prototypeMock = returnValue[prop];\n\t\t\t\t\t// the method was overidden because of inheritence, ignore it\n\t\t\t\t\t// eslint-disable-next-line ts/no-use-before-define\n\t\t\t\t\tif (prototypeMock !== mock.prototype[prop]) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst isMock = isMockFunction(prototypeMock);\n\t\t\t\t\tconst prototypeState = isMock ? prototypeMock.mock : undefined;\n\t\t\t\t\tconst prototypeConfig = isMock ? MOCK_CONFIGS.get(prototypeMock) : undefined;\n\t\t\t\t\treturnValue[prop] = createMockInstance({\n\t\t\t\t\t\toriginalImplementation: keepMembersImplementation ? prototypeConfig?.mockOriginal : undefined,\n\t\t\t\t\t\tprototypeState,\n\t\t\t\t\t\tprototypeConfig,\n\t\t\t\t\t\tkeepMembersImplementation\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturnValue = implementation.apply(this, args);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthrownValue = error;\n\t\t\tdidThrow = true;\n\t\t\tif (error instanceof TypeError && error.message.includes(\"is not a constructor\")) {\n\t\t\t\tconsole.warn(`[vitest] The ${namedObject[name].getMockName()} mock did not use 'function' or 'class' in its implementation, see https://vitest.dev/api/vi#vi-spyon for examples.`);\n\t\t\t}\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tif (didThrow) {\n\t\t\t\tresult.type = \"throw\";\n\t\t\t\tresult.value = thrownValue;\n\t\t\t\tsettledResult.type = \"rejected\";\n\t\t\t\tsettledResult.value = thrownValue;\n\t\t\t} else {\n\t\t\t\tresult.type = \"return\";\n\t\t\t\tresult.value = returnValue;\n\t\t\t\tif (new.target) {\n\t\t\t\t\tstate.contexts[contextIndex - 1] = returnValue;\n\t\t\t\t\tstate.instances[instanceIndex - 1] = returnValue;\n\t\t\t\t\tif (contextPrototypeIndex != null && prototypeState) {\n\t\t\t\t\t\tprototypeState.contexts[contextPrototypeIndex - 1] = returnValue;\n\t\t\t\t\t}\n\t\t\t\t\tif (instancePrototypeIndex != null && prototypeState) {\n\t\t\t\t\t\tprototypeState.instances[instancePrototypeIndex - 1] = returnValue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (returnValue instanceof Promise) {\n\t\t\t\t\treturnValue.then((settledValue) => {\n\t\t\t\t\t\tsettledResult.type = \"fulfilled\";\n\t\t\t\t\t\tsettledResult.value = settledValue;\n\t\t\t\t\t}, (rejectedValue) => {\n\t\t\t\t\t\tsettledResult.type = \"rejected\";\n\t\t\t\t\t\tsettledResult.value = rejectedValue;\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tsettledResult.type = \"fulfilled\";\n\t\t\t\t\tsettledResult.value = returnValue;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn returnValue;\n\t}) };\n\tconst mock = namedObject[name];\n\tconst copyPropertiesFrom = original || pseudoOriginal;\n\tif (copyPropertiesFrom) {\n\t\tcopyOriginalStaticProperties(mock, copyPropertiesFrom);\n\t}\n\treturn mock;\n}\nfunction registerCalls(args, state, prototypeState) {\n\tstate.calls.push(args);\n\tprototypeState?.calls.push(args);\n}\nfunction registerInvocationOrder(order, state, prototypeState) {\n\tstate.invocationCallOrder.push(order);\n\tprototypeState?.invocationCallOrder.push(order);\n}\nfunction registerResult(result, state, prototypeState) {\n\tstate.results.push(result);\n\tprototypeState?.results.push(result);\n}\nfunction registerSettledResult(result, state, prototypeState) {\n\tstate.settledResults.push(result);\n\tprototypeState?.settledResults.push(result);\n}\nfunction registerInstance(instance, state, prototypeState) {\n\tconst instanceIndex = state.instances.push(instance);\n\tconst instancePrototypeIndex = prototypeState?.instances.push(instance);\n\treturn [instanceIndex, instancePrototypeIndex];\n}\nfunction registerContext(context, state, prototypeState) {\n\tconst contextIndex = state.contexts.push(context);\n\tconst contextPrototypeIndex = prototypeState?.contexts.push(context);\n\treturn [contextIndex, contextPrototypeIndex];\n}\nfunction copyOriginalStaticProperties(mock, original) {\n\tconst { properties, descriptors } = getAllProperties(original);\n\tfor (const key of properties) {\n\t\tconst descriptor = descriptors[key];\n\t\tconst mockDescriptor = getDescriptor(mock, key);\n\t\tif (mockDescriptor) {\n\t\t\tcontinue;\n\t\t}\n\t\tObject.defineProperty(mock, key, descriptor);\n\t}\n}\nconst ignoreProperties = new Set([\n\t\"length\",\n\t\"name\",\n\t\"prototype\",\n\tSymbol.for(\"nodejs.util.promisify.custom\")\n]);\nfunction getAllProperties(original) {\n\tconst properties = new Set();\n\tconst descriptors = {};\n\twhile (original && original !== Object.prototype && original !== Function.prototype) {\n\t\tconst ownProperties = [...Object.getOwnPropertyNames(original), ...Object.getOwnPropertySymbols(original)];\n\t\tfor (const prop of ownProperties) {\n\t\t\tif (descriptors[prop] || ignoreProperties.has(prop)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tproperties.add(prop);\n\t\t\tdescriptors[prop] = Object.getOwnPropertyDescriptor(original, prop);\n\t\t}\n\t\toriginal = Object.getPrototypeOf(original);\n\t}\n\treturn {\n\t\tproperties,\n\t\tdescriptors\n\t};\n}\nfunction getDefaultConfig(original) {\n\treturn {\n\t\tmockImplementation: undefined,\n\t\tmockOriginal: original,\n\t\tmockName: \"vi.fn()\",\n\t\tonceMockImplementations: []\n\t};\n}\nfunction getDefaultState() {\n\tconst state = {\n\t\tcalls: [],\n\t\tcontexts: [],\n\t\tinstances: [],\n\t\tinvocationCallOrder: [],\n\t\tsettledResults: [],\n\t\tresults: [],\n\t\tget lastCall() {\n\t\t\treturn state.calls.at(-1);\n\t\t}\n\t};\n\treturn state;\n}\nfunction restoreAllMocks() {\n\tfor (const restore of MOCK_RESTORE) {\n\t\trestore();\n\t}\n\tMOCK_RESTORE.clear();\n}\nfunction clearAllMocks() {\n\tREGISTERED_MOCKS.forEach((mock) => mock.mockClear());\n}\nfunction resetAllMocks() {\n\tREGISTERED_MOCKS.forEach((mock) => mock.mockReset());\n}\nfunction throwConstructorError(shorthand) {\n\tthrow new TypeError(`Cannot use \\`${shorthand}\\` when called with \\`new\\`. Use \\`mockImplementation\\` with a \\`class\\` keyword instead. See https://vitest.dev/api/mock#class-support for more information.`);\n}\n\nexport { clearAllMocks, createMockInstance, fn, isMockFunction, resetAllMocks, restoreAllMocks, spyOn };\n"],"x_google_ignoreList":[0],"mappings":";AAAA,SAAS,eAAe,IAAI;AAC3B,QAAO,OAAO,OAAO,cAAc,qBAAqB,MAAM,GAAG,oBAAoB;;AAEtF,MAAM,+BAAe,IAAI,KAAK;AAI9B,MAAM,mCAAmB,IAAI,KAAK;AAClC,MAAM,+BAAe,IAAI,SAAS;AAClC,SAAS,mBAAmB,UAAU,EAAE,EAAE;CACzC,MAAM,EAAE,wBAAwB,SAAS,oBAAoB,2BAA2B,oBAAoB;AAC5G,KAAI,QACH,cAAa,IAAI,QAAQ;CAE1B,MAAM,SAAS,iBAAiB,uBAAuB;CACvD,MAAM,QAAQ,iBAAiB;CAC/B,MAAM,OAAO,WAAW;EACvB;EACA;EACA,GAAG;EACH,CAAC;CACF,MAAM,cAAc,sBAAsB,yBAAyB,UAAU;AAC7E,QAAO,eAAe,MAAM,UAAU;EACrC,UAAU;EACV,YAAY;EACZ,OAAO;EACP,cAAc;EACd,CAAC;AAIF,KAAI,gBACH,QAAO,WAAW,KAAK,QAAQ;A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W,CAAC;;AAErD,SAAS,gBAAgB;AACxB,kBAAiB,SAAS,SAAS,KAAK,WAAW,CAAC;;AAErD,SAAS,sBAAsB,WAAW;AACzC,OAAM,IAAI,UAAU,gBAAgB,UAAU,+JAA+J"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
//#region ../../node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js
|
|
2
|
+
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
3
|
+
function normalizeWindowsPath(input = "") {
|
|
4
|
+
if (!input) return input;
|
|
5
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
6
|
+
}
|
|
7
|
+
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
8
|
+
function cwd() {
|
|
9
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
|
|
10
|
+
return "/";
|
|
11
|
+
}
|
|
12
|
+
const resolve = function(...arguments_) {
|
|
13
|
+
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
14
|
+
let resolvedPath = "";
|
|
15
|
+
let resolvedAbsolute = false;
|
|
16
|
+
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
17
|
+
const path = index >= 0 ? arguments_[index] : cwd();
|
|
18
|
+
if (!path || path.length === 0) continue;
|
|
19
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
20
|
+
resolvedAbsolute = isAbsolute(path);
|
|
21
|
+
}
|
|
22
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
23
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) return `/${resolvedPath}`;
|
|
24
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
25
|
+
};
|
|
26
|
+
function normalizeString(path, allowAboveRoot) {
|
|
27
|
+
let res = "";
|
|
28
|
+
let lastSegmentLength = 0;
|
|
29
|
+
let lastSlash = -1;
|
|
30
|
+
let dots = 0;
|
|
31
|
+
let char = null;
|
|
32
|
+
for (let index = 0; index <= path.length; ++index) {
|
|
33
|
+
if (index < path.length) char = path[index];
|
|
34
|
+
else if (char === "/") break;
|
|
35
|
+
else char = "/";
|
|
36
|
+
if (char === "/") {
|
|
37
|
+
if (lastSlash === index - 1 || dots === 1);
|
|
38
|
+
else if (dots === 2) {
|
|
39
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
40
|
+
if (res.length > 2) {
|
|
41
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
42
|
+
if (lastSlashIndex === -1) {
|
|
43
|
+
res = "";
|
|
44
|
+
lastSegmentLength = 0;
|
|
45
|
+
} else {
|
|
46
|
+
res = res.slice(0, lastSlashIndex);
|
|
47
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
48
|
+
}
|
|
49
|
+
lastSlash = index;
|
|
50
|
+
dots = 0;
|
|
51
|
+
continue;
|
|
52
|
+
} else if (res.length > 0) {
|
|
53
|
+
res = "";
|
|
54
|
+
lastSegmentLength = 0;
|
|
55
|
+
lastSlash = index;
|
|
56
|
+
dots = 0;
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (allowAboveRoot) {
|
|
61
|
+
res += res.length > 0 ? "/.." : "..";
|
|
62
|
+
lastSegmentLength = 2;
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
|
|
66
|
+
else res = path.slice(lastSlash + 1, index);
|
|
67
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
68
|
+
}
|
|
69
|
+
lastSlash = index;
|
|
70
|
+
dots = 0;
|
|
71
|
+
} else if (char === "." && dots !== -1) ++dots;
|
|
72
|
+
else dots = -1;
|
|
73
|
+
}
|
|
74
|
+
return res;
|
|
75
|
+
}
|
|
76
|
+
const isAbsolute = function(p) {
|
|
77
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
78
|
+
};
|
|
79
|
+
//#endregion
|
|
80
|
+
export { resolve };
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=chunk-pathe.M-eThtNZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-pathe.M-eThtNZ.js","names":[],"sources":["../../../../../../../node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js"],"sourcesContent":["const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\\//;\nfunction normalizeWindowsPath(input = \"\") {\n if (!input) {\n return input;\n }\n return input.replace(/\\\\/g, \"/\").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());\n}\n\nconst _UNC_REGEX = /^[/\\\\]{2}/;\nconst _IS_ABSOLUTE_RE = /^[/\\\\](?![/\\\\])|^[/\\\\]{2}(?!\\.)|^[A-Za-z]:[/\\\\]/;\nconst _DRIVE_LETTER_RE = /^[A-Za-z]:$/;\nconst normalize = function(path) {\n if (path.length === 0) {\n return \".\";\n }\n path = normalizeWindowsPath(path);\n const isUNCPath = path.match(_UNC_REGEX);\n const isPathAbsolute = isAbsolute(path);\n const trailingSeparator = path[path.length - 1] === \"/\";\n path = normalizeString(path, !isPathAbsolute);\n if (path.length === 0) {\n if (isPathAbsolute) {\n return \"/\";\n }\n return trailingSeparator ? \"./\" : \".\";\n }\n if (trailingSeparator) {\n path += \"/\";\n }\n if (_DRIVE_LETTER_RE.test(path)) {\n path += \"/\";\n }\n if (isUNCPath) {\n if (!isPathAbsolute) {\n return `//./${path}`;\n }\n return `//${path}`;\n }\n return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;\n};\nconst join = function(...segments) {\n let path = \"\";\n for (const seg of segments) {\n if (!seg) {\n continue;\n }\n if (path.length > 0) {\n const pathTrailing = path[path.length - 1] === \"/\";\n const segLeading = seg[0] === \"/\";\n const both = pathTrailing && segLeading;\n if (both) {\n path += seg.slice(1);\n } else {\n path += pathTrailing || segLeading ? seg : `/${seg}`;\n }\n } else {\n path += seg;\n }\n }\n return normalize(path);\n};\nfunction cwd() {\n if (typeof process !== \"undefined\" && typeof process.cwd === \"function\") {\n return process.cwd().replace(/\\\\/g, \"/\");\n }\n return \"/\";\n}\nconst resolve = function(...arguments_) {\n arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));\n let resolvedPath = \"\";\n let resolvedAbsolute = false;\n for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {\n const path = index >= 0 ? arguments_[index] : cwd();\n if (!path || path.length === 0) {\n continue;\n }\n resolvedPath = `${path}/${resolvedPath}`;\n resolvedAbsolute = isAbsolute(path);\n }\n resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);\n if (resolvedAbsolute && !isAbsolute(resolvedPath)) {\n return `/${resolvedPath}`;\n }\n return resolvedPath.length > 0 ? resolvedPath : \".\";\n};\nfunction normalizeString(path, allowAboveRoot) {\n let res = \"\";\n let lastSegmentLength = 0;\n let lastSlash = -1;\n let dots = 0;\n let char = null;\n for (let index = 0; index <= path.length; ++index) {\n if (index < path.length) {\n char = path[index];\n } else if (char === \"/\") {\n break;\n } else {\n char = \"/\";\n }\n if (char === \"/\") {\n if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) {\n if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== \".\" || res[res.length - 2] !== \".\") {\n if (res.length > 2) {\n const lastSlashIndex = res.lastIndexOf(\"/\");\n if (lastSlashIndex === -1) {\n res = \"\";\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf(\"/\");\n }\n lastSlash = index;\n dots = 0;\n continue;\n } else if (res.length > 0) {\n res = \"\";\n lastSegmentLength = 0;\n lastSlash = index;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n res += res.length > 0 ? \"/..\" : \"..\";\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0) {\n res += `/${path.slice(lastSlash + 1, index)}`;\n } else {\n res = path.slice(lastSlash + 1, index);\n }\n lastSegmentLength = index - lastSlash - 1;\n }\n lastSlash = index;\n dots = 0;\n } else if (char === \".\" && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\nconst isAbsolute = function(p) {\n return _IS_ABSOLUTE_RE.test(p);\n};\nconst dirname = function(p) {\n const segments = normalizeWindowsPath(p).replace(/\\/$/, \"\").split(\"/\").slice(0, -1);\n if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) {\n segments[0] += \"/\";\n }\n return segments.join(\"/\") || (isAbsolute(p) ? \"/\" : \".\");\n};\n\nexport { dirname as d, join as j, resolve as r };\n"],"x_google_ignoreList":[0],"mappings":";AAAA,MAAM,yBAAyB;AAC/B,SAAS,qBAAqB,QAAQ,IAAI;AACxC,KAAI,CAAC,MACH,QAAO;AAET,QAAO,MAAM,QAAQ,OAAO,IAAI,CAAC,QAAQ,yBAAyB,MAAM,EAAE,aAAa,CAAC;;AAI1F,MAAM,kBAAkB;AAoDxB,SAAS,MAAM;AACb,KAAI,OAAO,YAAY,eAAe,OAAO,QAAQ,QAAQ,WAC3D,QAAO,QAAQ,KAAK,CAAC,QAAQ,OAAO,IAAI;AAE1C,QAAO;;AAET,MAAM,UAAU,SAAS,GAAG,YAAY;AACtC,cAAa,WAAW,KAAK,aAAa,qBAAqB,SAAS,CAAC;CACzE,IAAI,eAAe;CACnB,IAAI,mBAAmB;AACvB,MAAK,IAAI,QAAQ,WAAW,SAAS,GAAG,SAAS,MAAM,CAAC,kBAAkB,SAAS;EACjF,MAAM,OAAO,SAAS,IAAI,WAAW,SAAS,KAAK;AACnD,MAAI,CAAC,QAAQ,KAAK,WAAW,EAC3B;AAEF,iBAAe,GAAG,KAAK,GAAG;AAC1B,qBAAmB,WAAW,KAAK;;AAErC,gBAAe,gBAAgB,cAAc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K,EAAE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DiffOptions, DiffOptionsColor } from "./types.d-BCElaP-c.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/@vitest/utils/dist/diff.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* @param a Expected value
|
|
6
|
+
* @param b Received value
|
|
7
|
+
* @param options Diff options
|
|
8
|
+
* @returns {string | null} a string diff
|
|
9
|
+
*/
|
|
10
|
+
declare function diff(a: any, b: any, options?: DiffOptions): string | undefined;
|
|
11
|
+
declare function printDiffOrStringify(received: unknown, expected: unknown, options?: DiffOptions): string | undefined;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { diff, printDiffOrStringify };
|
|
14
|
+
//# sourceMappingURL=diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.d.ts","names":["D","DiffOptions","a","DiffOptionsColor","S","SerializedDiffOptions","DIFF_DELETE","DIFF_INSERT","DIFF_EQUAL","Diff","constructor","op","text","diffLinesUnified","Array","aLines","bLines","options","diffLinesUnified2","aLinesDisplay","bLinesDisplay","aLinesCompare","bLinesCompare","diffLinesRaw","diffStringsUnified","b","diffStringsRaw","cleanup","diff","printDiffOrStringify","received","expected","replaceAsymmetricMatcher","WeakKey","WeakSet","actual","actualReplaced","expectedReplaced","replacedActual","replacedExpected","PrintLabel","string","getLabelPrinter","strings"],"sources":["../../../../../../../node_modules/@vitest/utils/dist/diff.d.ts"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;iBAmFiB4B,IAAAA,CAAK1B,CAAAA,OAAQuB,CAAAA,OAAQR,OAAAA,GAAUhB,WAAAA;AAAAA,iBAC/B4B,oBAAAA,CAAqBC,QAAAA,WAAmBC,QAAAA,WAAmBd,OAAAA,GAAUhB,WAAAA"}
|