diff options
| author | Shipwreckt <me@shipwreckt.co.uk> | 2025-10-31 20:02:14 +0000 |
|---|---|---|
| committer | Shipwreckt <me@shipwreckt.co.uk> | 2025-10-31 20:02:14 +0000 |
| commit | 7a52ddeba2a68388b544f529d2d92104420f77b0 (patch) | |
| tree | 15ddd47457a2cb4a96060747437d36474e4f6b4e /node_modules/liquidjs/dist/util | |
| parent | 53d6ae2b5568437afa5e4995580a3fb679b7b91b (diff) | |
Changed from static to 11ty!
Diffstat (limited to 'node_modules/liquidjs/dist/util')
22 files changed, 220 insertions, 0 deletions
diff --git a/node_modules/liquidjs/dist/util/assert.d.ts b/node_modules/liquidjs/dist/util/assert.d.ts new file mode 100644 index 0000000..230729e --- /dev/null +++ b/node_modules/liquidjs/dist/util/assert.d.ts @@ -0,0 +1,2 @@ +export declare function assert<T>(predicate: T | null | undefined, message?: string | (() => string)): void;
+export declare function assertEmpty<T>(predicate: T | null | undefined, message?: string): void;
diff --git a/node_modules/liquidjs/dist/util/assert.spec.d.ts b/node_modules/liquidjs/dist/util/assert.spec.d.ts new file mode 100644 index 0000000..509db18 --- /dev/null +++ b/node_modules/liquidjs/dist/util/assert.spec.d.ts @@ -0,0 +1 @@ +export {};
diff --git a/node_modules/liquidjs/dist/util/async.d.ts b/node_modules/liquidjs/dist/util/async.d.ts new file mode 100644 index 0000000..9d75958 --- /dev/null +++ b/node_modules/liquidjs/dist/util/async.d.ts @@ -0,0 +1,2 @@ +export declare function toPromise<T>(val: Generator<unknown, T, unknown> | Promise<T> | T): Promise<T>;
+export declare function toValueSync<T>(val: Generator<unknown, T, unknown> | T): T;
diff --git a/node_modules/liquidjs/dist/util/async.spec.d.ts b/node_modules/liquidjs/dist/util/async.spec.d.ts new file mode 100644 index 0000000..509db18 --- /dev/null +++ b/node_modules/liquidjs/dist/util/async.spec.d.ts @@ -0,0 +1 @@ +export {};
diff --git a/node_modules/liquidjs/dist/util/character.d.ts b/node_modules/liquidjs/dist/util/character.d.ts new file mode 100644 index 0000000..e41d432 --- /dev/null +++ b/node_modules/liquidjs/dist/util/character.d.ts @@ -0,0 +1,10 @@ +export declare const TYPES: number[];
+export declare const WORD = 1;
+export declare const OPERATOR = 2;
+export declare const BLANK = 4;
+export declare const QUOTE = 8;
+export declare const INLINE_BLANK = 16;
+export declare const NUMBER = 32;
+export declare const SIGN = 64;
+export declare const PUNCTUATION = 128;
+export declare function isWord(char: string): boolean;
diff --git a/node_modules/liquidjs/dist/util/error.d.ts b/node_modules/liquidjs/dist/util/error.d.ts new file mode 100644 index 0000000..215005d --- /dev/null +++ b/node_modules/liquidjs/dist/util/error.d.ts @@ -0,0 +1,35 @@ +import { Token } from '../tokens/token';
+import { Template } from '../template/template';
+export declare abstract class LiquidError extends Error {
+ token: Token;
+ context: string;
+ originalError?: Error;
+ constructor(err: Error | string, token: Token);
+ protected update(): void;
+ static is(obj: unknown): obj is LiquidError;
+}
+export declare class TokenizationError extends LiquidError {
+ constructor(message: string, token: Token);
+}
+export declare class ParseError extends LiquidError {
+ constructor(err: Error, token: Token);
+}
+export declare class RenderError extends LiquidError {
+ constructor(err: Error, tpl: Template);
+ static is(obj: any): obj is RenderError;
+}
+export declare class LiquidErrors extends LiquidError {
+ errors: RenderError[];
+ constructor(errors: RenderError[]);
+ static is(obj: any): obj is LiquidErrors;
+}
+export declare class UndefinedVariableError extends LiquidError {
+ constructor(err: Error, token: Token);
+}
+export declare class InternalUndefinedVariableError extends Error {
+ variableName: string;
+ constructor(variableName: string);
+}
+export declare class AssertionError extends Error {
+ constructor(message: string);
+}
diff --git a/node_modules/liquidjs/dist/util/error.spec.d.ts b/node_modules/liquidjs/dist/util/error.spec.d.ts new file mode 100644 index 0000000..509db18 --- /dev/null +++ b/node_modules/liquidjs/dist/util/error.spec.d.ts @@ -0,0 +1 @@ +export {};
diff --git a/node_modules/liquidjs/dist/util/index.d.ts b/node_modules/liquidjs/dist/util/index.d.ts new file mode 100644 index 0000000..fa6a79c --- /dev/null +++ b/node_modules/liquidjs/dist/util/index.d.ts @@ -0,0 +1,12 @@ +export * from './error';
+export * from './character';
+export * from './assert';
+export * from './literal';
+export * from './underscore';
+export * from './operator-trie';
+export * from './type-guards';
+export * from './async';
+export * from './strftime';
+export * from './liquid-date';
+export * from './limiter';
+export * from './intl';
diff --git a/node_modules/liquidjs/dist/util/intl.d.ts b/node_modules/liquidjs/dist/util/intl.d.ts new file mode 100644 index 0000000..4037931 --- /dev/null +++ b/node_modules/liquidjs/dist/util/intl.d.ts @@ -0,0 +1,6 @@ +export declare function getDateTimeFormat(): {
+ (locales?: string | string[] | undefined, options?: Intl.DateTimeFormatOptions | undefined): Intl.DateTimeFormat;
+ new (locales?: string | string[] | undefined, options?: Intl.DateTimeFormatOptions | undefined): Intl.DateTimeFormat;
+ supportedLocalesOf(locales: string | string[], options?: Intl.DateTimeFormatOptions | undefined): string[];
+ readonly prototype: Intl.DateTimeFormat;
+} | undefined;
diff --git a/node_modules/liquidjs/dist/util/limiter.d.ts b/node_modules/liquidjs/dist/util/limiter.d.ts new file mode 100644 index 0000000..75b025d --- /dev/null +++ b/node_modules/liquidjs/dist/util/limiter.d.ts @@ -0,0 +1,8 @@ +export declare class Limiter {
+ private message;
+ private base;
+ private limit;
+ constructor(resource: string, limit: number);
+ use(count: number): void;
+ check(count: number): void;
+}
diff --git a/node_modules/liquidjs/dist/util/liquid-date.d.ts b/node_modules/liquidjs/dist/util/liquid-date.d.ts new file mode 100644 index 0000000..88097e9 --- /dev/null +++ b/node_modules/liquidjs/dist/util/liquid-date.d.ts @@ -0,0 +1,52 @@ +/**
+ * A date implementation with timezone info, just like Ruby date
+ *
+ * Implementation:
+ * - create a Date offset by it's timezone difference, avoiding overriding a bunch of methods
+ * - rewrite getTimezoneOffset() to trick strftime
+ */
+export declare class LiquidDate {
+ private locale;
+ private timezoneOffset;
+ private timezoneName;
+ private date;
+ private displayDate;
+ private DateTimeFormat;
+ timezoneFixed: boolean;
+ constructor(init: string | number | Date, locale: string, timezone?: number | string);
+ getTime(): number;
+ getMilliseconds(): number;
+ getSeconds(): number;
+ getMinutes(): number;
+ getHours(): number;
+ getDay(): number;
+ getDate(): number;
+ getMonth(): number;
+ getFullYear(): number;
+ toLocaleString(locale?: string, init?: any): string;
+ toLocaleTimeString(locale?: string): string;
+ toLocaleDateString(locale?: string): string;
+ getTimezoneOffset(): number;
+ getTimeZoneName(): string | undefined;
+ getLongMonthName(): string;
+ getShortMonthName(): string;
+ getLongWeekdayName(): string;
+ getShortWeekdayName(): string;
+ valid(): boolean;
+ private format;
+ /**
+ * Create a Date object fixed to it's declared Timezone. Both
+ * - 2021-08-06T02:29:00.000Z and
+ * - 2021-08-06T02:29:00.000+08:00
+ * will always be displayed as
+ * - 2021-08-06 02:29:00
+ * regardless timezoneOffset in JavaScript realm
+ *
+ * The implementation hack:
+ * Instead of calling `.getMonth()`/`.getUTCMonth()` respect to `preserveTimezones`,
+ * we create a different Date to trick strftime, it's both simpler and more performant.
+ * Given that a template is expected to be parsed fewer times than rendered.
+ */
+ static createDateFixedToTimezone(dateString: string, locale: string): LiquidDate;
+ private static getTimezoneOffset;
+}
diff --git a/node_modules/liquidjs/dist/util/liquid-date.spec.d.ts b/node_modules/liquidjs/dist/util/liquid-date.spec.d.ts new file mode 100644 index 0000000..509db18 --- /dev/null +++ b/node_modules/liquidjs/dist/util/liquid-date.spec.d.ts @@ -0,0 +1 @@ +export {};
diff --git a/node_modules/liquidjs/dist/util/literal.d.ts b/node_modules/liquidjs/dist/util/literal.d.ts new file mode 100644 index 0000000..bc1b406 --- /dev/null +++ b/node_modules/liquidjs/dist/util/literal.d.ts @@ -0,0 +1,11 @@ +import { BlankDrop, EmptyDrop, NullDrop } from '../drop';
+export declare const literalValues: {
+ true: boolean;
+ false: boolean;
+ nil: NullDrop;
+ null: NullDrop;
+ empty: EmptyDrop;
+ blank: BlankDrop;
+};
+export type LiteralKey = keyof typeof literalValues;
+export type LiteralValue = typeof literalValues[LiteralKey];
diff --git a/node_modules/liquidjs/dist/util/operator-trie.d.ts b/node_modules/liquidjs/dist/util/operator-trie.d.ts new file mode 100644 index 0000000..b21050e --- /dev/null +++ b/node_modules/liquidjs/dist/util/operator-trie.d.ts @@ -0,0 +1,14 @@ +interface TrieInput<T> {
+ [key: string]: T;
+}
+interface TrieLeafNode<T> {
+ data: T;
+ end: true;
+ needBoundary?: true;
+}
+export interface Trie<T> {
+ [key: string]: Trie<T> | TrieLeafNode<T>;
+}
+export type TrieNode<T> = Trie<T> | TrieLeafNode<T>;
+export declare function createTrie<T = any>(input: TrieInput<T>): Trie<T>;
+export {};
diff --git a/node_modules/liquidjs/dist/util/performance.d.ts b/node_modules/liquidjs/dist/util/performance.d.ts new file mode 100644 index 0000000..4dca49a --- /dev/null +++ b/node_modules/liquidjs/dist/util/performance.d.ts @@ -0,0 +1,5 @@ +interface LiquidPerformance {
+ now: () => number;
+}
+export declare function getPerformance(): LiquidPerformance;
+export {};
diff --git a/node_modules/liquidjs/dist/util/performance.spec.d.ts b/node_modules/liquidjs/dist/util/performance.spec.d.ts new file mode 100644 index 0000000..509db18 --- /dev/null +++ b/node_modules/liquidjs/dist/util/performance.spec.d.ts @@ -0,0 +1 @@ +export {};
diff --git a/node_modules/liquidjs/dist/util/strftime.d.ts b/node_modules/liquidjs/dist/util/strftime.d.ts new file mode 100644 index 0000000..5e4aea5 --- /dev/null +++ b/node_modules/liquidjs/dist/util/strftime.d.ts @@ -0,0 +1,2 @@ +import { LiquidDate } from './liquid-date';
+export declare function strftime(d: LiquidDate, formatStr: string): string;
diff --git a/node_modules/liquidjs/dist/util/strftime.spec.d.ts b/node_modules/liquidjs/dist/util/strftime.spec.d.ts new file mode 100644 index 0000000..509db18 --- /dev/null +++ b/node_modules/liquidjs/dist/util/strftime.spec.d.ts @@ -0,0 +1 @@ +export {};
diff --git a/node_modules/liquidjs/dist/util/type-guards.d.ts b/node_modules/liquidjs/dist/util/type-guards.d.ts new file mode 100644 index 0000000..b6ea5e7 --- /dev/null +++ b/node_modules/liquidjs/dist/util/type-guards.d.ts @@ -0,0 +1,13 @@ +import { RangeToken, NumberToken, QuotedToken, LiteralToken, PropertyAccessToken, OutputToken, HTMLToken, TagToken, IdentifierToken, DelimitedToken, OperatorToken, ValueToken } from '../tokens';
+export declare function isDelimitedToken(val: any): val is DelimitedToken;
+export declare function isOperatorToken(val: any): val is OperatorToken;
+export declare function isHTMLToken(val: any): val is HTMLToken;
+export declare function isOutputToken(val: any): val is OutputToken;
+export declare function isTagToken(val: any): val is TagToken;
+export declare function isQuotedToken(val: any): val is QuotedToken;
+export declare function isLiteralToken(val: any): val is LiteralToken;
+export declare function isNumberToken(val: any): val is NumberToken;
+export declare function isPropertyAccessToken(val: any): val is PropertyAccessToken;
+export declare function isWordToken(val: any): val is IdentifierToken;
+export declare function isRangeToken(val: any): val is RangeToken;
+export declare function isValueToken(val: any): val is ValueToken;
diff --git a/node_modules/liquidjs/dist/util/type-guards.spec.d.ts b/node_modules/liquidjs/dist/util/type-guards.spec.d.ts new file mode 100644 index 0000000..509db18 --- /dev/null +++ b/node_modules/liquidjs/dist/util/type-guards.spec.d.ts @@ -0,0 +1 @@ +export {};
diff --git a/node_modules/liquidjs/dist/util/underscore.d.ts b/node_modules/liquidjs/dist/util/underscore.d.ts new file mode 100644 index 0000000..c54f852 --- /dev/null +++ b/node_modules/liquidjs/dist/util/underscore.d.ts @@ -0,0 +1,40 @@ +export declare const toString: () => string;
+export declare const hasOwnProperty: (v: PropertyKey) => boolean;
+export declare function isString(value: any): value is string;
+export declare function isFunction(value: any): value is Function;
+export declare function isPromise<T>(val: any): val is Promise<T>;
+export declare function isIterator(val: any): val is IterableIterator<any>;
+export declare function escapeRegex(str: string): string;
+export declare function promisify<T1, T2>(fn: (arg1: T1, cb: (err: Error | null, result: T2) => void) => void): (arg1: T1) => Promise<T2>;
+export declare function promisify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, cb: (err: Error | null, result: T3) => void) => void): (arg1: T1, arg2: T2) => Promise<T3>;
+export declare function stringify(value: any): string;
+export declare function toEnumerable<T = unknown>(val: any): T[];
+export declare function toArray(val: any): any[];
+export declare function toValue(value: any): any;
+export declare function toNumber(value: any): number;
+export declare function isNumber(value: any): value is number;
+export declare function toLiquid(value: any): any;
+export declare function isNil(value: any): boolean;
+export declare function isUndefined(value: any): boolean;
+export declare function isArray(value: any): value is any[];
+export declare function isArrayLike(value: any): value is any[];
+export declare function isIterable(value: any): value is Iterable<any>;
+export declare function forOwn<T>(obj: Record<string, T> | undefined, iteratee: ((val: T, key: string, obj: {
+ [key: string]: T;
+}) => boolean | void)): Record<string, T>;
+export declare function last<T>(arr: T[]): T;
+export declare function last(arr: string): string;
+export declare function isObject(value: any): value is object;
+export declare function range(start: number, stop: number, step?: number): number[];
+export declare function padStart(str: any, length: number, ch?: string): any;
+export declare function padEnd(str: any, length: number, ch?: string): any;
+export declare function pad(str: any, length: number, ch: string, add: (str: string, ch: string) => string): any;
+export declare function identify<T>(val: T): T;
+export declare function changeCase(str: string): string;
+export declare function ellipsis(str: string, N: number): string;
+export declare function caseInsensitiveCompare(a: any, b: any): 0 | 1 | -1;
+export declare function argumentsToValue<F extends (...args: any) => any, T>(fn: F): (this: T, ...args: Parameters<F>) => any;
+export declare function argumentsToNumber<F extends (...args: any) => any, T>(fn: F): (this: T, ...args: Parameters<F>) => any;
+export declare function escapeRegExp(text: string): string;
+/** Return an array containing unique elements from _array_. Works with nested arrays and objects. */
+export declare function strictUniq<T>(array: Array<T>): Generator<T>;
diff --git a/node_modules/liquidjs/dist/util/underscore.spec.d.ts b/node_modules/liquidjs/dist/util/underscore.spec.d.ts new file mode 100644 index 0000000..509db18 --- /dev/null +++ b/node_modules/liquidjs/dist/util/underscore.spec.d.ts @@ -0,0 +1 @@ +export {};
|
