@farming-labs/theme 0.0.24 → 0.0.26

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.
Files changed (53) hide show
  1. package/dist/_virtual/_rolldown/runtime.mjs +26 -1
  2. package/dist/docs-api.mjs +3 -1
  3. package/dist/docs-layout.mjs +9 -4
  4. package/dist/get-app-dir.d.mts +9 -0
  5. package/dist/get-app-dir.mjs +16 -0
  6. package/dist/get-app-dir.test.d.mts +1 -0
  7. package/dist/get-app-dir.test.mjs +41 -0
  8. package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +77 -0
  9. package/dist/node_modules/.pnpm/@vitest_expect@3.2.4/node_modules/@vitest/expect/dist/index.mjs +1356 -0
  10. package/dist/node_modules/.pnpm/@vitest_pretty-format@3.2.4/node_modules/@vitest/pretty-format/dist/index.mjs +1119 -0
  11. package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.mjs +1091 -0
  12. package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/index.mjs +4 -0
  13. package/dist/node_modules/.pnpm/@vitest_runner@3.2.4/node_modules/@vitest/runner/dist/utils.mjs +3 -0
  14. package/dist/node_modules/.pnpm/@vitest_snapshot@3.2.4/node_modules/@vitest/snapshot/dist/index.mjs +1821 -0
  15. package/dist/node_modules/.pnpm/@vitest_spy@3.2.4/node_modules/@vitest/spy/dist/index.mjs +171 -0
  16. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.mjs +124 -0
  17. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/diff.mjs +1334 -0
  18. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/error.mjs +105 -0
  19. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/helpers.mjs +118 -0
  20. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/index.mjs +455 -0
  21. package/dist/node_modules/.pnpm/@vitest_utils@3.2.4/node_modules/@vitest/utils/dist/source-map.mjs +168 -0
  22. package/dist/node_modules/.pnpm/chai@5.3.3/node_modules/chai/index.mjs +3087 -0
  23. package/dist/node_modules/.pnpm/js-tokens@9.0.1/node_modules/js-tokens/index.mjs +384 -0
  24. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.mjs +11 -0
  25. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.mjs +16 -0
  26. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.mjs +11 -0
  27. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.mjs +15 -0
  28. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.mjs +13 -0
  29. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.mjs +34 -0
  30. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.mjs +12 -0
  31. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.mjs +122 -0
  32. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.mjs +39 -0
  33. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.mjs +99 -0
  34. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.mjs +25 -0
  35. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.mjs +14 -0
  36. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.mjs +21 -0
  37. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.mjs +5 -0
  38. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.mjs +12 -0
  39. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.mjs +18 -0
  40. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.mjs +25 -0
  41. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.mjs +8 -0
  42. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.mjs +30 -0
  43. package/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs +939 -0
  44. package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +81 -0
  45. package/dist/node_modules/.pnpm/strip-literal@3.1.0/node_modules/strip-literal/dist/index.mjs +51 -0
  46. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.mjs +81 -0
  47. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.mjs +9 -0
  48. package/dist/node_modules/.pnpm/tinyspy@4.0.4/node_modules/tinyspy/dist/index.mjs +125 -0
  49. 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
  50. 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
  51. 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
  52. 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
  53. package/package.json +6 -3
@@ -0,0 +1,105 @@
1
+ import "../../../../../tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.mjs";
2
+ import "../../../../../loupe@3.2.1/node_modules/loupe/lib/index.mjs";
3
+ import { format, stringify } from "./chunk-_commonjsHelpers.mjs";
4
+ import { printDiffOrStringify } from "./diff.mjs";
5
+
6
+ //#region ../../node_modules/.pnpm/@vitest+utils@3.2.4/node_modules/@vitest/utils/dist/error.js
7
+ const IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@";
8
+ const IS_COLLECTION_SYMBOL = "@@__IMMUTABLE_ITERABLE__@@";
9
+ function isImmutable(v) {
10
+ return v && (v[IS_COLLECTION_SYMBOL] || v[IS_RECORD_SYMBOL]);
11
+ }
12
+ const OBJECT_PROTO = Object.getPrototypeOf({});
13
+ function getUnserializableMessage(err) {
14
+ if (err instanceof Error) return `<unserializable>: ${err.message}`;
15
+ if (typeof err === "string") return `<unserializable>: ${err}`;
16
+ return "<unserializable>";
17
+ }
18
+ function serializeValue(val, seen = /* @__PURE__ */ new WeakMap()) {
19
+ if (!val || typeof val === "string") return val;
20
+ if (val instanceof Error && "toJSON" in val && typeof val.toJSON === "function") {
21
+ const jsonValue = val.toJSON();
22
+ if (jsonValue && jsonValue !== val && typeof jsonValue === "object") {
23
+ if (typeof val.message === "string") safe(() => jsonValue.message ?? (jsonValue.message = val.message));
24
+ if (typeof val.stack === "string") safe(() => jsonValue.stack ?? (jsonValue.stack = val.stack));
25
+ if (typeof val.name === "string") safe(() => jsonValue.name ?? (jsonValue.name = val.name));
26
+ if (val.cause != null) safe(() => jsonValue.cause ?? (jsonValue.cause = serializeValue(val.cause, seen)));
27
+ }
28
+ return serializeValue(jsonValue, seen);
29
+ }
30
+ if (typeof val === "function") return `Function<${val.name || "anonymous"}>`;
31
+ if (typeof val === "symbol") return val.toString();
32
+ if (typeof val !== "object") return val;
33
+ if (typeof Buffer !== "undefined" && val instanceof Buffer) return `<Buffer(${val.length}) ...>`;
34
+ if (typeof Uint8Array !== "undefined" && val instanceof Uint8Array) return `<Uint8Array(${val.length}) ...>`;
35
+ if (isImmutable(val)) return serializeValue(val.toJSON(), seen);
36
+ if (val instanceof Promise || val.constructor && val.constructor.prototype === "AsyncFunction") return "Promise";
37
+ if (typeof Element !== "undefined" && val instanceof Element) return val.tagName;
38
+ if (typeof val.asymmetricMatch === "function") return `${val.toString()} ${format(val.sample)}`;
39
+ if (typeof val.toJSON === "function") return serializeValue(val.toJSON(), seen);
40
+ if (seen.has(val)) return seen.get(val);
41
+ if (Array.isArray(val)) {
42
+ const clone = new Array(val.length);
43
+ seen.set(val, clone);
44
+ val.forEach((e, i) => {
45
+ try {
46
+ clone[i] = serializeValue(e, seen);
47
+ } catch (err) {
48
+ clone[i] = getUnserializableMessage(err);
49
+ }
50
+ });
51
+ return clone;
52
+ } else {
53
+ const clone = Object.create(null);
54
+ seen.set(val, clone);
55
+ let obj = val;
56
+ while (obj && obj !== OBJECT_PROTO) {
57
+ Object.getOwnPropertyNames(obj).forEach((key) => {
58
+ if (key in clone) return;
59
+ try {
60
+ clone[key] = serializeValue(val[key], seen);
61
+ } catch (err) {
62
+ delete clone[key];
63
+ clone[key] = getUnserializableMessage(err);
64
+ }
65
+ });
66
+ obj = Object.getPrototypeOf(obj);
67
+ }
68
+ return clone;
69
+ }
70
+ }
71
+ function safe(fn) {
72
+ try {
73
+ return fn();
74
+ } catch {}
75
+ }
76
+ function normalizeErrorMessage(message) {
77
+ return message.replace(/__(vite_ssr_import|vi_import)_\d+__\./g, "");
78
+ }
79
+ function processError(_err, diffOptions, seen = /* @__PURE__ */ new WeakSet()) {
80
+ if (!_err || typeof _err !== "object") return { message: String(_err) };
81
+ const err = _err;
82
+ if (err.showDiff || err.showDiff === void 0 && err.expected !== void 0 && err.actual !== void 0) err.diff = printDiffOrStringify(err.actual, err.expected, {
83
+ ...diffOptions,
84
+ ...err.diffOptions
85
+ });
86
+ if ("expected" in err && typeof err.expected !== "string") err.expected = stringify(err.expected, 10);
87
+ if ("actual" in err && typeof err.actual !== "string") err.actual = stringify(err.actual, 10);
88
+ try {
89
+ if (typeof err.message === "string") err.message = normalizeErrorMessage(err.message);
90
+ } catch {}
91
+ try {
92
+ if (!seen.has(err) && typeof err.cause === "object") {
93
+ seen.add(err);
94
+ err.cause = processError(err.cause, diffOptions, seen);
95
+ }
96
+ } catch {}
97
+ try {
98
+ return serializeValue(err);
99
+ } catch (e) {
100
+ return serializeValue(/* @__PURE__ */ new Error(`Failed to fully serialize error: ${e === null || e === void 0 ? void 0 : e.message}\nInner error message: ${err === null || err === void 0 ? void 0 : err.message}`));
101
+ }
102
+ }
103
+
104
+ //#endregion
105
+ export { processError };
@@ -0,0 +1,118 @@
1
+ //#region ../../node_modules/.pnpm/@vitest+utils@3.2.4/node_modules/@vitest/utils/dist/helpers.js
2
+ /**
3
+ * Get original stacktrace without source map support the most performant way.
4
+ * - Create only 1 stack frame.
5
+ * - Rewrite prepareStackTrace to bypass "support-stack-trace" (usually takes ~250ms).
6
+ */
7
+ function createSimpleStackTrace(options) {
8
+ const { message = "$$stack trace error", stackTraceLimit = 1 } = options || {};
9
+ const limit = Error.stackTraceLimit;
10
+ const prepareStackTrace = Error.prepareStackTrace;
11
+ Error.stackTraceLimit = stackTraceLimit;
12
+ Error.prepareStackTrace = (e) => e.stack;
13
+ const stackTrace = new Error(message).stack || "";
14
+ Error.prepareStackTrace = prepareStackTrace;
15
+ Error.stackTraceLimit = limit;
16
+ return stackTrace;
17
+ }
18
+ function assertTypes(value, name, types) {
19
+ const receivedType = typeof value;
20
+ if (!types.includes(receivedType)) throw new TypeError(`${name} value must be ${types.join(" or ")}, received "${receivedType}"`);
21
+ }
22
+ function toArray(array) {
23
+ if (array === null || array === void 0) array = [];
24
+ if (Array.isArray(array)) return array;
25
+ return [array];
26
+ }
27
+ function isObject(item) {
28
+ return item != null && typeof item === "object" && !Array.isArray(item);
29
+ }
30
+ function isFinalObj(obj) {
31
+ return obj === Object.prototype || obj === Function.prototype || obj === RegExp.prototype;
32
+ }
33
+ function getType(value) {
34
+ return Object.prototype.toString.apply(value).slice(8, -1);
35
+ }
36
+ function collectOwnProperties(obj, collector) {
37
+ const collect = typeof collector === "function" ? collector : (key) => collector.add(key);
38
+ Object.getOwnPropertyNames(obj).forEach(collect);
39
+ Object.getOwnPropertySymbols(obj).forEach(collect);
40
+ }
41
+ function getOwnProperties(obj) {
42
+ const ownProps = /* @__PURE__ */ new Set();
43
+ if (isFinalObj(obj)) return [];
44
+ collectOwnProperties(obj, ownProps);
45
+ return Array.from(ownProps);
46
+ }
47
+ const defaultCloneOptions = { forceWritable: false };
48
+ function deepClone(val, options = defaultCloneOptions) {
49
+ return clone(val, /* @__PURE__ */ new WeakMap(), options);
50
+ }
51
+ function clone(val, seen, options = defaultCloneOptions) {
52
+ let k, out;
53
+ if (seen.has(val)) return seen.get(val);
54
+ if (Array.isArray(val)) {
55
+ out = Array.from({ length: k = val.length });
56
+ seen.set(val, out);
57
+ while (k--) out[k] = clone(val[k], seen, options);
58
+ return out;
59
+ }
60
+ if (Object.prototype.toString.call(val) === "[object Object]") {
61
+ out = Object.create(Object.getPrototypeOf(val));
62
+ seen.set(val, out);
63
+ const props = getOwnProperties(val);
64
+ for (const k of props) {
65
+ const descriptor = Object.getOwnPropertyDescriptor(val, k);
66
+ if (!descriptor) continue;
67
+ const cloned = clone(val[k], seen, options);
68
+ if (options.forceWritable) Object.defineProperty(out, k, {
69
+ enumerable: descriptor.enumerable,
70
+ configurable: true,
71
+ writable: true,
72
+ value: cloned
73
+ });
74
+ else if ("get" in descriptor) Object.defineProperty(out, k, {
75
+ ...descriptor,
76
+ get() {
77
+ return cloned;
78
+ }
79
+ });
80
+ else Object.defineProperty(out, k, {
81
+ ...descriptor,
82
+ value: cloned
83
+ });
84
+ }
85
+ return out;
86
+ }
87
+ return val;
88
+ }
89
+ function noop() {}
90
+ function objectAttr(source, path, defaultValue = void 0) {
91
+ const paths = path.replace(/\[(\d+)\]/g, ".$1").split(".");
92
+ let result = source;
93
+ for (const p of paths) {
94
+ result = new Object(result)[p];
95
+ if (result === void 0) return defaultValue;
96
+ }
97
+ return result;
98
+ }
99
+ function createDefer() {
100
+ let resolve = null;
101
+ let reject = null;
102
+ const p = new Promise((_resolve, _reject) => {
103
+ resolve = _resolve;
104
+ reject = _reject;
105
+ });
106
+ p.resolve = resolve;
107
+ p.reject = reject;
108
+ return p;
109
+ }
110
+ function isNegativeNaN(val) {
111
+ if (!Number.isNaN(val)) return false;
112
+ const f64 = new Float64Array(1);
113
+ f64[0] = val;
114
+ return new Uint32Array(f64.buffer)[1] >>> 31 === 1;
115
+ }
116
+
117
+ //#endregion
118
+ export { assertTypes, clone, createDefer, createSimpleStackTrace, deepClone, getOwnProperties, getType, isNegativeNaN, isObject, noop, objectAttr, toArray };
@@ -0,0 +1,455 @@
1
+ import "../../../../../tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.mjs";
2
+ import "../../../../../loupe@3.2.1/node_modules/loupe/lib/index.mjs";
3
+ import { format, getDefaultExportFromCjs, inspect, objDisplay, stringify } from "./chunk-_commonjsHelpers.mjs";
4
+ import { assertTypes, clone, createDefer, createSimpleStackTrace, deepClone, getOwnProperties, getType, isNegativeNaN, isObject, noop, objectAttr, toArray } from "./helpers.mjs";
5
+
6
+ //#region ../../node_modules/.pnpm/@vitest+utils@3.2.4/node_modules/@vitest/utils/dist/index.js
7
+ var jsTokens_1;
8
+ var hasRequiredJsTokens;
9
+ function requireJsTokens() {
10
+ if (hasRequiredJsTokens) return jsTokens_1;
11
+ hasRequiredJsTokens = 1;
12
+ var Identifier, JSXIdentifier, JSXPunctuator, JSXString, JSXText, KeywordsWithExpressionAfter, KeywordsWithNoLineTerminatorAfter, LineTerminatorSequence, MultiLineComment, Newline, NumericLiteral, Punctuator, RegularExpressionLiteral = /\/(?![*\/])(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\\]).|\\.)*(\/[$_\u200C\u200D\p{ID_Continue}]*|\\)?/uy, SingleLineComment, StringLiteral, Template, TokensNotPrecedingObjectLiteral, TokensPrecedingExpression, WhiteSpace;
13
+ Punctuator = /--|\+\+|=>|\.{3}|\??\.(?!\d)|(?:&&|\|\||\?\?|[+\-%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2}|\/(?![\/*]))=?|[?~,:;[\](){}]/y;
14
+ Identifier = /(\x23?)(?=[$_\p{ID_Start}\\])(?:[$_\u200C\u200D\p{ID_Continue}]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+/uy;
15
+ StringLiteral = /(['"])(?:(?!\1)[^\\\n\r]|\\(?:\r\n|[^]))*(\1)?/y;
16
+ NumericLiteral = /(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[oO][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*)n?|0n|[1-9](?:_?\d)*n|(?:(?:0(?!\d)|0\d*[89]\d*|[1-9](?:_?\d)*)(?:\.(?:\d(?:_?\d)*)?)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?|0[0-7]+/y;
17
+ Template = /[`}](?:[^`\\$]|\\[^]|\$(?!\{))*(`|\$\{)?/y;
18
+ WhiteSpace = /[\t\v\f\ufeff\p{Zs}]+/uy;
19
+ LineTerminatorSequence = /\r?\n|[\r\u2028\u2029]/y;
20
+ MultiLineComment = /\/\*(?:[^*]|\*(?!\/))*(\*\/)?/y;
21
+ SingleLineComment = /\/\/.*/y;
22
+ JSXPunctuator = /[<>.:={}]|\/(?![\/*])/y;
23
+ JSXIdentifier = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}-]*/uy;
24
+ JSXString = /(['"])(?:(?!\1)[^])*(\1)?/y;
25
+ JSXText = /[^<>{}]+/y;
26
+ TokensPrecedingExpression = /^(?:[\/+-]|\.{3}|\?(?:InterpolationIn(?:JSX|Template)|NoLineTerminatorHere|NonExpressionParenEnd|UnaryIncDec))?$|[{}([,;<>=*%&|^!~?:]$/;
27
+ TokensNotPrecedingObjectLiteral = /^(?:=>|[;\]){}]|else|\?(?:NoLineTerminatorHere|NonExpressionParenEnd))?$/;
28
+ KeywordsWithExpressionAfter = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/;
29
+ KeywordsWithNoLineTerminatorAfter = /^(?:return|throw|yield)$/;
30
+ Newline = RegExp(LineTerminatorSequence.source);
31
+ jsTokens_1 = function* (input, { jsx = false } = {}) {
32
+ var braces, firstCodePoint, isExpression, lastIndex, lastSignificantToken, length, match, mode, nextLastIndex, nextLastSignificantToken, parenNesting, postfixIncDec, punctuator, stack;
33
+ ({length} = input);
34
+ lastIndex = 0;
35
+ lastSignificantToken = "";
36
+ stack = [{ tag: "JS" }];
37
+ braces = [];
38
+ parenNesting = 0;
39
+ postfixIncDec = false;
40
+ while (lastIndex < length) {
41
+ mode = stack[stack.length - 1];
42
+ switch (mode.tag) {
43
+ case "JS":
44
+ case "JSNonExpressionParen":
45
+ case "InterpolationInTemplate":
46
+ case "InterpolationInJSX":
47
+ if (input[lastIndex] === "/" && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
48
+ RegularExpressionLiteral.lastIndex = lastIndex;
49
+ if (match = RegularExpressionLiteral.exec(input)) {
50
+ lastIndex = RegularExpressionLiteral.lastIndex;
51
+ lastSignificantToken = match[0];
52
+ postfixIncDec = true;
53
+ yield {
54
+ type: "RegularExpressionLiteral",
55
+ value: match[0],
56
+ closed: match[1] !== void 0 && match[1] !== "\\"
57
+ };
58
+ continue;
59
+ }
60
+ }
61
+ Punctuator.lastIndex = lastIndex;
62
+ if (match = Punctuator.exec(input)) {
63
+ punctuator = match[0];
64
+ nextLastIndex = Punctuator.lastIndex;
65
+ nextLastSignificantToken = punctuator;
66
+ switch (punctuator) {
67
+ case "(":
68
+ if (lastSignificantToken === "?NonExpressionParenKeyword") stack.push({
69
+ tag: "JSNonExpressionParen",
70
+ nesting: parenNesting
71
+ });
72
+ parenNesting++;
73
+ postfixIncDec = false;
74
+ break;
75
+ case ")":
76
+ parenNesting--;
77
+ postfixIncDec = true;
78
+ if (mode.tag === "JSNonExpressionParen" && parenNesting === mode.nesting) {
79
+ stack.pop();
80
+ nextLastSignificantToken = "?NonExpressionParenEnd";
81
+ postfixIncDec = false;
82
+ }
83
+ break;
84
+ case "{":
85
+ Punctuator.lastIndex = 0;
86
+ isExpression = !TokensNotPrecedingObjectLiteral.test(lastSignificantToken) && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken));
87
+ braces.push(isExpression);
88
+ postfixIncDec = false;
89
+ break;
90
+ case "}":
91
+ switch (mode.tag) {
92
+ case "InterpolationInTemplate":
93
+ if (braces.length === mode.nesting) {
94
+ Template.lastIndex = lastIndex;
95
+ match = Template.exec(input);
96
+ lastIndex = Template.lastIndex;
97
+ lastSignificantToken = match[0];
98
+ if (match[1] === "${") {
99
+ lastSignificantToken = "?InterpolationInTemplate";
100
+ postfixIncDec = false;
101
+ yield {
102
+ type: "TemplateMiddle",
103
+ value: match[0]
104
+ };
105
+ } else {
106
+ stack.pop();
107
+ postfixIncDec = true;
108
+ yield {
109
+ type: "TemplateTail",
110
+ value: match[0],
111
+ closed: match[1] === "`"
112
+ };
113
+ }
114
+ continue;
115
+ }
116
+ break;
117
+ case "InterpolationInJSX": if (braces.length === mode.nesting) {
118
+ stack.pop();
119
+ lastIndex += 1;
120
+ lastSignificantToken = "}";
121
+ yield {
122
+ type: "JSXPunctuator",
123
+ value: "}"
124
+ };
125
+ continue;
126
+ }
127
+ }
128
+ postfixIncDec = braces.pop();
129
+ nextLastSignificantToken = postfixIncDec ? "?ExpressionBraceEnd" : "}";
130
+ break;
131
+ case "]":
132
+ postfixIncDec = true;
133
+ break;
134
+ case "++":
135
+ case "--":
136
+ nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec";
137
+ break;
138
+ case "<":
139
+ if (jsx && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
140
+ stack.push({ tag: "JSXTag" });
141
+ lastIndex += 1;
142
+ lastSignificantToken = "<";
143
+ yield {
144
+ type: "JSXPunctuator",
145
+ value: punctuator
146
+ };
147
+ continue;
148
+ }
149
+ postfixIncDec = false;
150
+ break;
151
+ default: postfixIncDec = false;
152
+ }
153
+ lastIndex = nextLastIndex;
154
+ lastSignificantToken = nextLastSignificantToken;
155
+ yield {
156
+ type: "Punctuator",
157
+ value: punctuator
158
+ };
159
+ continue;
160
+ }
161
+ Identifier.lastIndex = lastIndex;
162
+ if (match = Identifier.exec(input)) {
163
+ lastIndex = Identifier.lastIndex;
164
+ nextLastSignificantToken = match[0];
165
+ switch (match[0]) {
166
+ case "for":
167
+ case "if":
168
+ case "while":
169
+ case "with": if (lastSignificantToken !== "." && lastSignificantToken !== "?.") nextLastSignificantToken = "?NonExpressionParenKeyword";
170
+ }
171
+ lastSignificantToken = nextLastSignificantToken;
172
+ postfixIncDec = !KeywordsWithExpressionAfter.test(match[0]);
173
+ yield {
174
+ type: match[1] === "#" ? "PrivateIdentifier" : "IdentifierName",
175
+ value: match[0]
176
+ };
177
+ continue;
178
+ }
179
+ StringLiteral.lastIndex = lastIndex;
180
+ if (match = StringLiteral.exec(input)) {
181
+ lastIndex = StringLiteral.lastIndex;
182
+ lastSignificantToken = match[0];
183
+ postfixIncDec = true;
184
+ yield {
185
+ type: "StringLiteral",
186
+ value: match[0],
187
+ closed: match[2] !== void 0
188
+ };
189
+ continue;
190
+ }
191
+ NumericLiteral.lastIndex = lastIndex;
192
+ if (match = NumericLiteral.exec(input)) {
193
+ lastIndex = NumericLiteral.lastIndex;
194
+ lastSignificantToken = match[0];
195
+ postfixIncDec = true;
196
+ yield {
197
+ type: "NumericLiteral",
198
+ value: match[0]
199
+ };
200
+ continue;
201
+ }
202
+ Template.lastIndex = lastIndex;
203
+ if (match = Template.exec(input)) {
204
+ lastIndex = Template.lastIndex;
205
+ lastSignificantToken = match[0];
206
+ if (match[1] === "${") {
207
+ lastSignificantToken = "?InterpolationInTemplate";
208
+ stack.push({
209
+ tag: "InterpolationInTemplate",
210
+ nesting: braces.length
211
+ });
212
+ postfixIncDec = false;
213
+ yield {
214
+ type: "TemplateHead",
215
+ value: match[0]
216
+ };
217
+ } else {
218
+ postfixIncDec = true;
219
+ yield {
220
+ type: "NoSubstitutionTemplate",
221
+ value: match[0],
222
+ closed: match[1] === "`"
223
+ };
224
+ }
225
+ continue;
226
+ }
227
+ break;
228
+ case "JSXTag":
229
+ case "JSXTagEnd":
230
+ JSXPunctuator.lastIndex = lastIndex;
231
+ if (match = JSXPunctuator.exec(input)) {
232
+ lastIndex = JSXPunctuator.lastIndex;
233
+ nextLastSignificantToken = match[0];
234
+ switch (match[0]) {
235
+ case "<":
236
+ stack.push({ tag: "JSXTag" });
237
+ break;
238
+ case ">":
239
+ stack.pop();
240
+ if (lastSignificantToken === "/" || mode.tag === "JSXTagEnd") {
241
+ nextLastSignificantToken = "?JSX";
242
+ postfixIncDec = true;
243
+ } else stack.push({ tag: "JSXChildren" });
244
+ break;
245
+ case "{":
246
+ stack.push({
247
+ tag: "InterpolationInJSX",
248
+ nesting: braces.length
249
+ });
250
+ nextLastSignificantToken = "?InterpolationInJSX";
251
+ postfixIncDec = false;
252
+ break;
253
+ case "/": if (lastSignificantToken === "<") {
254
+ stack.pop();
255
+ if (stack[stack.length - 1].tag === "JSXChildren") stack.pop();
256
+ stack.push({ tag: "JSXTagEnd" });
257
+ }
258
+ }
259
+ lastSignificantToken = nextLastSignificantToken;
260
+ yield {
261
+ type: "JSXPunctuator",
262
+ value: match[0]
263
+ };
264
+ continue;
265
+ }
266
+ JSXIdentifier.lastIndex = lastIndex;
267
+ if (match = JSXIdentifier.exec(input)) {
268
+ lastIndex = JSXIdentifier.lastIndex;
269
+ lastSignificantToken = match[0];
270
+ yield {
271
+ type: "JSXIdentifier",
272
+ value: match[0]
273
+ };
274
+ continue;
275
+ }
276
+ JSXString.lastIndex = lastIndex;
277
+ if (match = JSXString.exec(input)) {
278
+ lastIndex = JSXString.lastIndex;
279
+ lastSignificantToken = match[0];
280
+ yield {
281
+ type: "JSXString",
282
+ value: match[0],
283
+ closed: match[2] !== void 0
284
+ };
285
+ continue;
286
+ }
287
+ break;
288
+ case "JSXChildren":
289
+ JSXText.lastIndex = lastIndex;
290
+ if (match = JSXText.exec(input)) {
291
+ lastIndex = JSXText.lastIndex;
292
+ lastSignificantToken = match[0];
293
+ yield {
294
+ type: "JSXText",
295
+ value: match[0]
296
+ };
297
+ continue;
298
+ }
299
+ switch (input[lastIndex]) {
300
+ case "<":
301
+ stack.push({ tag: "JSXTag" });
302
+ lastIndex++;
303
+ lastSignificantToken = "<";
304
+ yield {
305
+ type: "JSXPunctuator",
306
+ value: "<"
307
+ };
308
+ continue;
309
+ case "{":
310
+ stack.push({
311
+ tag: "InterpolationInJSX",
312
+ nesting: braces.length
313
+ });
314
+ lastIndex++;
315
+ lastSignificantToken = "?InterpolationInJSX";
316
+ postfixIncDec = false;
317
+ yield {
318
+ type: "JSXPunctuator",
319
+ value: "{"
320
+ };
321
+ continue;
322
+ }
323
+ }
324
+ WhiteSpace.lastIndex = lastIndex;
325
+ if (match = WhiteSpace.exec(input)) {
326
+ lastIndex = WhiteSpace.lastIndex;
327
+ yield {
328
+ type: "WhiteSpace",
329
+ value: match[0]
330
+ };
331
+ continue;
332
+ }
333
+ LineTerminatorSequence.lastIndex = lastIndex;
334
+ if (match = LineTerminatorSequence.exec(input)) {
335
+ lastIndex = LineTerminatorSequence.lastIndex;
336
+ postfixIncDec = false;
337
+ if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) lastSignificantToken = "?NoLineTerminatorHere";
338
+ yield {
339
+ type: "LineTerminatorSequence",
340
+ value: match[0]
341
+ };
342
+ continue;
343
+ }
344
+ MultiLineComment.lastIndex = lastIndex;
345
+ if (match = MultiLineComment.exec(input)) {
346
+ lastIndex = MultiLineComment.lastIndex;
347
+ if (Newline.test(match[0])) {
348
+ postfixIncDec = false;
349
+ if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) lastSignificantToken = "?NoLineTerminatorHere";
350
+ }
351
+ yield {
352
+ type: "MultiLineComment",
353
+ value: match[0],
354
+ closed: match[1] !== void 0
355
+ };
356
+ continue;
357
+ }
358
+ SingleLineComment.lastIndex = lastIndex;
359
+ if (match = SingleLineComment.exec(input)) {
360
+ lastIndex = SingleLineComment.lastIndex;
361
+ postfixIncDec = false;
362
+ yield {
363
+ type: "SingleLineComment",
364
+ value: match[0]
365
+ };
366
+ continue;
367
+ }
368
+ firstCodePoint = String.fromCodePoint(input.codePointAt(lastIndex));
369
+ lastIndex += firstCodePoint.length;
370
+ lastSignificantToken = firstCodePoint;
371
+ postfixIncDec = false;
372
+ yield {
373
+ type: mode.tag.startsWith("JSX") ? "JSXInvalid" : "Invalid",
374
+ value: firstCodePoint
375
+ };
376
+ }
377
+ };
378
+ return jsTokens_1;
379
+ }
380
+ var jsTokens = /* @__PURE__ */ getDefaultExportFromCjs(requireJsTokens());
381
+ var reservedWords = {
382
+ keyword: [
383
+ "break",
384
+ "case",
385
+ "catch",
386
+ "continue",
387
+ "debugger",
388
+ "default",
389
+ "do",
390
+ "else",
391
+ "finally",
392
+ "for",
393
+ "function",
394
+ "if",
395
+ "return",
396
+ "switch",
397
+ "throw",
398
+ "try",
399
+ "var",
400
+ "const",
401
+ "while",
402
+ "with",
403
+ "new",
404
+ "this",
405
+ "super",
406
+ "class",
407
+ "extends",
408
+ "export",
409
+ "import",
410
+ "null",
411
+ "true",
412
+ "false",
413
+ "in",
414
+ "instanceof",
415
+ "typeof",
416
+ "void",
417
+ "delete"
418
+ ],
419
+ strict: [
420
+ "implements",
421
+ "interface",
422
+ "let",
423
+ "package",
424
+ "private",
425
+ "protected",
426
+ "public",
427
+ "static",
428
+ "yield"
429
+ ]
430
+ }, keywords = new Set(reservedWords.keyword), reservedWordsStrictSet = new Set(reservedWords.strict), sometimesKeywords = /* @__PURE__ */ new Set([
431
+ "as",
432
+ "async",
433
+ "from",
434
+ "get",
435
+ "of",
436
+ "set"
437
+ ]);
438
+ const SAFE_TIMERS_SYMBOL = Symbol("vitest:SAFE_TIMERS");
439
+ function getSafeTimers() {
440
+ const { setTimeout: safeSetTimeout, setInterval: safeSetInterval, clearInterval: safeClearInterval, clearTimeout: safeClearTimeout, setImmediate: safeSetImmediate, clearImmediate: safeClearImmediate, queueMicrotask: safeQueueMicrotask } = globalThis[SAFE_TIMERS_SYMBOL] || globalThis;
441
+ const { nextTick: safeNextTick } = globalThis[SAFE_TIMERS_SYMBOL] || globalThis.process || { nextTick: (cb) => cb() };
442
+ return {
443
+ nextTick: safeNextTick,
444
+ setTimeout: safeSetTimeout,
445
+ setInterval: safeSetInterval,
446
+ clearInterval: safeClearInterval,
447
+ clearTimeout: safeClearTimeout,
448
+ setImmediate: safeSetImmediate,
449
+ clearImmediate: safeClearImmediate,
450
+ queueMicrotask: safeQueueMicrotask
451
+ };
452
+ }
453
+
454
+ //#endregion
455
+ export { getSafeTimers };