@farming-labs/theme 0.0.24 → 0.0.25
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/_virtual/_rolldown/runtime.mjs +26 -1
- package/dist/docs-api.mjs +3 -1
- package/dist/docs-layout.mjs +7 -3
- package/dist/get-app-dir.d.mts +9 -0
- package/dist/get-app-dir.mjs +16 -0
- package/dist/get-app-dir.test.d.mts +1 -0
- package/dist/get-app-dir.test.mjs +41 -0
- package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +77 -0
- package/dist/node_modules/.pnpm/@vitest_expect@3.2.4/node_modules/@vitest/expect/dist/index.mjs +1356 -0
- package/dist/node_modules/.pnpm/@vitest_pretty-format@3.2.4/node_modules/@vitest/pretty-format/dist/index.mjs +1119 -0
- package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.mjs +1091 -0
- package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/index.mjs +4 -0
- package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/utils.mjs +3 -0
- package/dist/node_modules/.pnpm/@vitest_snapshot@3.2.4/node_modules/@vitest/snapshot/dist/index.mjs +1821 -0
- package/dist/node_modules/.pnpm/@vitest_spy@3.2.4/node_modules/@vitest/spy/dist/index.mjs +171 -0
- package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.mjs +124 -0
- package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/diff.mjs +1334 -0
- package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/error.mjs +105 -0
- package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/helpers.mjs +118 -0
- package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/index.mjs +455 -0
- package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/source-map.mjs +168 -0
- package/dist/node_modules/.pnpm/chai@5.3.3/node_modules/chai/index.mjs +3087 -0
- package/dist/node_modules/.pnpm/js-tokens@9.0.1/node_modules/js-tokens/index.mjs +384 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.mjs +11 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.mjs +16 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.mjs +11 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.mjs +15 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.mjs +13 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.mjs +34 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.mjs +12 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.mjs +122 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.mjs +39 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.mjs +99 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.mjs +25 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.mjs +14 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.mjs +21 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.mjs +5 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.mjs +12 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.mjs +18 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.mjs +25 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.mjs +8 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.mjs +30 -0
- package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs +939 -0
- package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +81 -0
- package/dist/node_modules/.pnpm/strip-literal@3.1.0/node_modules/strip-literal/dist/index.mjs +51 -0
- package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.mjs +81 -0
- package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.mjs +9 -0
- package/dist/node_modules/.pnpm/tinyspy@4.0.4/node_modules/tinyspy/dist/index.mjs +125 -0
- package/dist/node_modules/.pnpm/vitest@3.2.4_@types_debug@4.1.12_@types_node@22.19.11_jiti@2.6.1_lightningcss@1.30.2_terser@5.46.0_yaml@2.8.2/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.mjs +8 -0
- package/dist/node_modules/.pnpm/vitest@3.2.4_@types_debug@4.1.12_@types_node@22.19.11_jiti@2.6.1_lightningcss@1.30.2_terser@5.46.0_yaml@2.8.2/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.mjs +50 -0
- package/dist/node_modules/.pnpm/vitest@3.2.4_@types_debug@4.1.12_@types_node@22.19.11_jiti@2.6.1_lightningcss@1.30.2_terser@5.46.0_yaml@2.8.2/node_modules/vitest/dist/chunks/utils.XdZDrNZV.mjs +48 -0
- package/dist/node_modules/.pnpm/vitest@3.2.4_@types_debug@4.1.12_@types_node@22.19.11_jiti@2.6.1_lightningcss@1.30.2_terser@5.46.0_yaml@2.8.2/node_modules/vitest/dist/chunks/vi.bdSIJ99Y.mjs +2613 -0
- package/package.json +6 -3
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { M, T } from "../../../../../tinyspy@4.0.4/node_modules/tinyspy/dist/index.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/@vitest+spy@3.2.4/node_modules/@vitest/spy/dist/index.js
|
|
4
|
+
const mocks = /* @__PURE__ */ new Set();
|
|
5
|
+
function isMockFunction(fn) {
|
|
6
|
+
return typeof fn === "function" && "_isMockFunction" in fn && fn._isMockFunction;
|
|
7
|
+
}
|
|
8
|
+
function spyOn(obj, method, accessType) {
|
|
9
|
+
const objMethod = accessType ? { [{
|
|
10
|
+
get: "getter",
|
|
11
|
+
set: "setter"
|
|
12
|
+
}[accessType]]: method } : method;
|
|
13
|
+
let state;
|
|
14
|
+
const descriptor = getDescriptor(obj, method);
|
|
15
|
+
const fn = descriptor && descriptor[accessType || "value"];
|
|
16
|
+
if (isMockFunction(fn)) state = fn.mock._state();
|
|
17
|
+
try {
|
|
18
|
+
const spy = enhanceSpy(M(obj, objMethod));
|
|
19
|
+
if (state) spy.mock._state(state);
|
|
20
|
+
return spy;
|
|
21
|
+
} catch (error) {
|
|
22
|
+
if (error instanceof TypeError && Symbol.toStringTag && obj[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(objMethod)}". Module namespace is not configurable in ESM. See: https://vitest.dev/guide/browser/#limitations`, { cause: error });
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
let callOrder = 0;
|
|
27
|
+
function enhanceSpy(spy) {
|
|
28
|
+
const stub = spy;
|
|
29
|
+
let implementation;
|
|
30
|
+
let onceImplementations = [];
|
|
31
|
+
let implementationChangedTemporarily = false;
|
|
32
|
+
let instances = [];
|
|
33
|
+
let contexts = [];
|
|
34
|
+
let invocations = [];
|
|
35
|
+
const state = T(spy);
|
|
36
|
+
const mockContext = {
|
|
37
|
+
get calls() {
|
|
38
|
+
return state.calls;
|
|
39
|
+
},
|
|
40
|
+
get contexts() {
|
|
41
|
+
return contexts;
|
|
42
|
+
},
|
|
43
|
+
get instances() {
|
|
44
|
+
return instances;
|
|
45
|
+
},
|
|
46
|
+
get invocationCallOrder() {
|
|
47
|
+
return invocations;
|
|
48
|
+
},
|
|
49
|
+
get results() {
|
|
50
|
+
return state.results.map(([callType, value]) => {
|
|
51
|
+
return {
|
|
52
|
+
type: callType === "error" ? "throw" : "return",
|
|
53
|
+
value
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
get settledResults() {
|
|
58
|
+
return state.resolves.map(([callType, value]) => {
|
|
59
|
+
return {
|
|
60
|
+
type: callType === "error" ? "rejected" : "fulfilled",
|
|
61
|
+
value
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
get lastCall() {
|
|
66
|
+
return state.calls[state.calls.length - 1];
|
|
67
|
+
},
|
|
68
|
+
_state(state) {
|
|
69
|
+
if (state) {
|
|
70
|
+
implementation = state.implementation;
|
|
71
|
+
onceImplementations = state.onceImplementations;
|
|
72
|
+
implementationChangedTemporarily = state.implementationChangedTemporarily;
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
implementation,
|
|
76
|
+
onceImplementations,
|
|
77
|
+
implementationChangedTemporarily
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
function mockCall(...args) {
|
|
82
|
+
instances.push(this);
|
|
83
|
+
contexts.push(this);
|
|
84
|
+
invocations.push(++callOrder);
|
|
85
|
+
return (implementationChangedTemporarily ? implementation : onceImplementations.shift() || implementation || state.getOriginal() || (() => {})).apply(this, args);
|
|
86
|
+
}
|
|
87
|
+
let name = stub.name;
|
|
88
|
+
stub.getMockName = () => name || "vi.fn()";
|
|
89
|
+
stub.mockName = (n) => {
|
|
90
|
+
name = n;
|
|
91
|
+
return stub;
|
|
92
|
+
};
|
|
93
|
+
stub.mockClear = () => {
|
|
94
|
+
state.reset();
|
|
95
|
+
instances = [];
|
|
96
|
+
contexts = [];
|
|
97
|
+
invocations = [];
|
|
98
|
+
return stub;
|
|
99
|
+
};
|
|
100
|
+
stub.mockReset = () => {
|
|
101
|
+
stub.mockClear();
|
|
102
|
+
implementation = void 0;
|
|
103
|
+
onceImplementations = [];
|
|
104
|
+
return stub;
|
|
105
|
+
};
|
|
106
|
+
stub.mockRestore = () => {
|
|
107
|
+
stub.mockReset();
|
|
108
|
+
state.restore();
|
|
109
|
+
return stub;
|
|
110
|
+
};
|
|
111
|
+
if (Symbol.dispose) stub[Symbol.dispose] = () => stub.mockRestore();
|
|
112
|
+
stub.getMockImplementation = () => implementationChangedTemporarily ? implementation : onceImplementations.at(0) || implementation;
|
|
113
|
+
stub.mockImplementation = (fn) => {
|
|
114
|
+
implementation = fn;
|
|
115
|
+
state.willCall(mockCall);
|
|
116
|
+
return stub;
|
|
117
|
+
};
|
|
118
|
+
stub.mockImplementationOnce = (fn) => {
|
|
119
|
+
onceImplementations.push(fn);
|
|
120
|
+
return stub;
|
|
121
|
+
};
|
|
122
|
+
function withImplementation(fn, cb) {
|
|
123
|
+
const originalImplementation = implementation;
|
|
124
|
+
implementation = fn;
|
|
125
|
+
state.willCall(mockCall);
|
|
126
|
+
implementationChangedTemporarily = true;
|
|
127
|
+
const reset = () => {
|
|
128
|
+
implementation = originalImplementation;
|
|
129
|
+
implementationChangedTemporarily = false;
|
|
130
|
+
};
|
|
131
|
+
const result = cb();
|
|
132
|
+
if (typeof result === "object" && result && typeof result.then === "function") return result.then(() => {
|
|
133
|
+
reset();
|
|
134
|
+
return stub;
|
|
135
|
+
});
|
|
136
|
+
reset();
|
|
137
|
+
return stub;
|
|
138
|
+
}
|
|
139
|
+
stub.withImplementation = withImplementation;
|
|
140
|
+
stub.mockReturnThis = () => stub.mockImplementation(function() {
|
|
141
|
+
return this;
|
|
142
|
+
});
|
|
143
|
+
stub.mockReturnValue = (val) => stub.mockImplementation(() => val);
|
|
144
|
+
stub.mockReturnValueOnce = (val) => stub.mockImplementationOnce(() => val);
|
|
145
|
+
stub.mockResolvedValue = (val) => stub.mockImplementation(() => Promise.resolve(val));
|
|
146
|
+
stub.mockResolvedValueOnce = (val) => stub.mockImplementationOnce(() => Promise.resolve(val));
|
|
147
|
+
stub.mockRejectedValue = (val) => stub.mockImplementation(() => Promise.reject(val));
|
|
148
|
+
stub.mockRejectedValueOnce = (val) => stub.mockImplementationOnce(() => Promise.reject(val));
|
|
149
|
+
Object.defineProperty(stub, "mock", { get: () => mockContext });
|
|
150
|
+
state.willCall(mockCall);
|
|
151
|
+
mocks.add(stub);
|
|
152
|
+
return stub;
|
|
153
|
+
}
|
|
154
|
+
function fn(implementation) {
|
|
155
|
+
const enhancedSpy = enhanceSpy(M({ spy: implementation || function() {} }, "spy"));
|
|
156
|
+
if (implementation) enhancedSpy.mockImplementation(implementation);
|
|
157
|
+
return enhancedSpy;
|
|
158
|
+
}
|
|
159
|
+
function getDescriptor(obj, method) {
|
|
160
|
+
const objDescriptor = Object.getOwnPropertyDescriptor(obj, method);
|
|
161
|
+
if (objDescriptor) return objDescriptor;
|
|
162
|
+
let currentProto = Object.getPrototypeOf(obj);
|
|
163
|
+
while (currentProto !== null) {
|
|
164
|
+
const descriptor = Object.getOwnPropertyDescriptor(currentProto, method);
|
|
165
|
+
if (descriptor) return descriptor;
|
|
166
|
+
currentProto = Object.getPrototypeOf(currentProto);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
//#endregion
|
|
171
|
+
export { fn, isMockFunction, mocks, spyOn };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { format as format$1, plugins } from "../../../../../@vitest_pretty-format@3.2.4/node_modules/@vitest/pretty-format/dist/index.mjs";
|
|
2
|
+
import inspect$1 from "../../../../../loupe@3.2.1/node_modules/loupe/lib/index.mjs";
|
|
3
|
+
|
|
4
|
+
//#region ../../node_modules/.pnpm/@vitest+utils@3.2.4/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js
|
|
5
|
+
const { AsymmetricMatcher, DOMCollection, DOMElement, Immutable, ReactElement, ReactTestComponent } = plugins;
|
|
6
|
+
const PLUGINS = [
|
|
7
|
+
ReactTestComponent,
|
|
8
|
+
ReactElement,
|
|
9
|
+
DOMElement,
|
|
10
|
+
DOMCollection,
|
|
11
|
+
Immutable,
|
|
12
|
+
AsymmetricMatcher
|
|
13
|
+
];
|
|
14
|
+
function stringify(object, maxDepth = 10, { maxLength, ...options } = {}) {
|
|
15
|
+
const MAX_LENGTH = maxLength ?? 1e4;
|
|
16
|
+
let result;
|
|
17
|
+
try {
|
|
18
|
+
result = format$1(object, {
|
|
19
|
+
maxDepth,
|
|
20
|
+
escapeString: false,
|
|
21
|
+
plugins: PLUGINS,
|
|
22
|
+
...options
|
|
23
|
+
});
|
|
24
|
+
} catch {
|
|
25
|
+
result = format$1(object, {
|
|
26
|
+
callToJSON: false,
|
|
27
|
+
maxDepth,
|
|
28
|
+
escapeString: false,
|
|
29
|
+
plugins: PLUGINS,
|
|
30
|
+
...options
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(Math.min(maxDepth, Number.MAX_SAFE_INTEGER) / 2), {
|
|
34
|
+
maxLength,
|
|
35
|
+
...options
|
|
36
|
+
}) : result;
|
|
37
|
+
}
|
|
38
|
+
const formatRegExp = /%[sdjifoOc%]/g;
|
|
39
|
+
function format(...args) {
|
|
40
|
+
if (typeof args[0] !== "string") {
|
|
41
|
+
const objects = [];
|
|
42
|
+
for (let i = 0; i < args.length; i++) objects.push(inspect(args[i], {
|
|
43
|
+
depth: 0,
|
|
44
|
+
colors: false
|
|
45
|
+
}));
|
|
46
|
+
return objects.join(" ");
|
|
47
|
+
}
|
|
48
|
+
const len = args.length;
|
|
49
|
+
let i = 1;
|
|
50
|
+
const template = args[0];
|
|
51
|
+
let str = String(template).replace(formatRegExp, (x) => {
|
|
52
|
+
if (x === "%%") return "%";
|
|
53
|
+
if (i >= len) return x;
|
|
54
|
+
switch (x) {
|
|
55
|
+
case "%s": {
|
|
56
|
+
const value = args[i++];
|
|
57
|
+
if (typeof value === "bigint") return `${value.toString()}n`;
|
|
58
|
+
if (typeof value === "number" && value === 0 && 1 / value < 0) return "-0";
|
|
59
|
+
if (typeof value === "object" && value !== null) {
|
|
60
|
+
if (typeof value.toString === "function" && value.toString !== Object.prototype.toString) return value.toString();
|
|
61
|
+
return inspect(value, {
|
|
62
|
+
depth: 0,
|
|
63
|
+
colors: false
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return String(value);
|
|
67
|
+
}
|
|
68
|
+
case "%d": {
|
|
69
|
+
const value = args[i++];
|
|
70
|
+
if (typeof value === "bigint") return `${value.toString()}n`;
|
|
71
|
+
return Number(value).toString();
|
|
72
|
+
}
|
|
73
|
+
case "%i": {
|
|
74
|
+
const value = args[i++];
|
|
75
|
+
if (typeof value === "bigint") return `${value.toString()}n`;
|
|
76
|
+
return Number.parseInt(String(value)).toString();
|
|
77
|
+
}
|
|
78
|
+
case "%f": return Number.parseFloat(String(args[i++])).toString();
|
|
79
|
+
case "%o": return inspect(args[i++], {
|
|
80
|
+
showHidden: true,
|
|
81
|
+
showProxy: true
|
|
82
|
+
});
|
|
83
|
+
case "%O": return inspect(args[i++]);
|
|
84
|
+
case "%c":
|
|
85
|
+
i++;
|
|
86
|
+
return "";
|
|
87
|
+
case "%j": try {
|
|
88
|
+
return JSON.stringify(args[i++]);
|
|
89
|
+
} catch (err) {
|
|
90
|
+
const m = err.message;
|
|
91
|
+
if (m.includes("circular structure") || m.includes("cyclic structures") || m.includes("cyclic object")) return "[Circular]";
|
|
92
|
+
throw err;
|
|
93
|
+
}
|
|
94
|
+
default: return x;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
for (let x = args[i]; i < len; x = args[++i]) if (x === null || typeof x !== "object") str += ` ${x}`;
|
|
98
|
+
else str += ` ${inspect(x)}`;
|
|
99
|
+
return str;
|
|
100
|
+
}
|
|
101
|
+
function inspect(obj, options = {}) {
|
|
102
|
+
if (options.truncate === 0) options.truncate = Number.POSITIVE_INFINITY;
|
|
103
|
+
return inspect$1(obj, options);
|
|
104
|
+
}
|
|
105
|
+
function objDisplay(obj, options = {}) {
|
|
106
|
+
if (typeof options.truncate === "undefined") options.truncate = 40;
|
|
107
|
+
const str = inspect(obj, options);
|
|
108
|
+
const type = Object.prototype.toString.call(obj);
|
|
109
|
+
if (options.truncate && str.length >= options.truncate) if (type === "[object Function]") {
|
|
110
|
+
const fn = obj;
|
|
111
|
+
return !fn.name ? "[Function]" : `[Function: ${fn.name}]`;
|
|
112
|
+
} else if (type === "[object Array]") return `[ Array(${obj.length}) ]`;
|
|
113
|
+
else if (type === "[object Object]") {
|
|
114
|
+
const keys = Object.keys(obj);
|
|
115
|
+
return `{ Object (${keys.length > 2 ? `${keys.splice(0, 2).join(", ")}, ...` : keys.join(", ")}) }`;
|
|
116
|
+
} else return str;
|
|
117
|
+
return str;
|
|
118
|
+
}
|
|
119
|
+
function getDefaultExportFromCjs(x) {
|
|
120
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
//#endregion
|
|
124
|
+
export { format, getDefaultExportFromCjs, inspect, objDisplay, stringify };
|