obsidian-dev-utils 19.0.0 → 19.0.1
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/CHANGELOG.md +5 -0
- package/README.md +0 -3
- package/dist/lib/@types/debug.d.mts +1 -16
- package/dist/lib/Async.d.mts +1 -153
- package/dist/lib/Blob.d.mts +1 -40
- package/dist/lib/CssClass.d.mts +1 -97
- package/dist/lib/Debug.d.mts +1 -41
- package/dist/lib/DebugController.d.mts +1 -85
- package/dist/lib/Enum.d.mts +1 -20
- package/dist/lib/Error.d.mts +1 -45
- package/dist/lib/Function.d.mts +1 -28
- package/dist/lib/HTMLElement.d.mts +1 -49
- package/dist/lib/Library.cjs +1 -1
- package/dist/lib/Library.d.mts +1 -16
- package/dist/lib/Library.mjs +1 -1
- package/dist/lib/Object.d.mts +1 -211
- package/dist/lib/Path.d.mts +1 -133
- package/dist/lib/RegExp.d.mts +1 -18
- package/dist/lib/ScriptUtils/CliUtils.d.mts +1 -70
- package/dist/lib/ScriptUtils/CodeGenerator.d.mts +1 -12
- package/dist/lib/ScriptUtils/ESLint/@types/@guardian__eslint-plugin-tsdoc-required.d.mts +1 -13
- package/dist/lib/ScriptUtils/ESLint/@types/eslint-plugin-modules-newlines.d.mts +1 -13
- package/dist/lib/ScriptUtils/ESLint/@types/eslint-plugin-verify-tsdoc.d.mts +1 -13
- package/dist/lib/ScriptUtils/ESLint/ESLint.d.mts +1 -13
- package/dist/lib/ScriptUtils/ESLint/eslint.config.d.mts +1 -16
- package/dist/lib/ScriptUtils/ESLint/index.d.mts +1 -2
- package/dist/lib/ScriptUtils/Exec.d.mts +1 -83
- package/dist/lib/ScriptUtils/Fs.d.mts +1 -72
- package/dist/lib/ScriptUtils/JSON.d.mts +1 -64
- package/dist/lib/ScriptUtils/NodeModules.d.mts +1 -14
- package/dist/lib/ScriptUtils/Npm.d.mts +1 -151
- package/dist/lib/ScriptUtils/NpmPublish.d.mts +1 -9
- package/dist/lib/ScriptUtils/ObsidianDevUtilsRepoPaths.d.mts +1 -88
- package/dist/lib/ScriptUtils/Root.d.mts +1 -67
- package/dist/lib/ScriptUtils/build.d.mts +1 -41
- package/dist/lib/ScriptUtils/cli.d.mts +1 -14
- package/dist/lib/ScriptUtils/esbuild/Dependency.d.mts +1 -18
- package/dist/lib/ScriptUtils/esbuild/ObsidianPluginBuilder.d.mts +1 -53
- package/dist/lib/ScriptUtils/esbuild/changeExtensionPlugin.d.mts +1 -12
- package/dist/lib/ScriptUtils/esbuild/copyToObsidianPluginsFolderPlugin.d.mts +1 -18
- package/dist/lib/ScriptUtils/esbuild/fixEsmPlugin.d.mts +1 -11
- package/dist/lib/ScriptUtils/esbuild/fixSourceMapsPlugin.d.mts +1 -17
- package/dist/lib/ScriptUtils/esbuild/index.d.mts +1 -9
- package/dist/lib/ScriptUtils/esbuild/preprocessPlugin.d.mts +1 -23
- package/dist/lib/ScriptUtils/esbuild/renameCssPlugin.d.mts +1 -8
- package/dist/lib/ScriptUtils/esbuild/svelteWrapperPlugin.d.mts +1 -8
- package/dist/lib/ScriptUtils/format.d.mts +1 -10
- package/dist/lib/ScriptUtils/index.d.mts +1 -17
- package/dist/lib/ScriptUtils/spellcheck.d.mts +1 -14
- package/dist/lib/ScriptUtils/version.d.mts +1 -171
- package/dist/lib/String.d.mts +1 -138
- package/dist/lib/Transformers/DateTransformer.d.mts +1 -35
- package/dist/lib/Transformers/DurationTransformer.d.mts +1 -34
- package/dist/lib/Transformers/GroupTransformer.d.mts +1 -65
- package/dist/lib/Transformers/SkipPrivatePropertyTransformer.d.mts +1 -32
- package/dist/lib/Transformers/Transformer.d.mts +1 -67
- package/dist/lib/Transformers/TypedTransformer.d.mts +1 -37
- package/dist/lib/Transformers/index.d.mts +1 -6
- package/dist/lib/ValueProvider.d.mts +1 -22
- package/dist/lib/codemirror/StateFieldSpec.d.mts +1 -68
- package/dist/lib/codemirror/index.d.mts +1 -1
- package/dist/lib/index.d.mts +1 -20
- package/dist/lib/obsidian/@types/Dataview/api/data-array.d.mts +1 -136
- package/dist/lib/obsidian/@types/Dataview/api/extensions.d.mts +1 -15
- package/dist/lib/obsidian/@types/Dataview/api/inline-api.d.mts +1 -186
- package/dist/lib/obsidian/@types/Dataview/api/plugin-api.d.mts +1 -209
- package/dist/lib/obsidian/@types/Dataview/api/result.d.mts +1 -38
- package/dist/lib/obsidian/@types/Dataview/data-import/common.d.mts +1 -3
- package/dist/lib/obsidian/@types/Dataview/data-import/csv.d.mts +1 -3
- package/dist/lib/obsidian/@types/Dataview/data-import/inline-field.d.mts +1 -42
- package/dist/lib/obsidian/@types/Dataview/data-import/markdown-file.d.mts +1 -52
- package/dist/lib/obsidian/@types/Dataview/data-import/persister.d.mts +1 -32
- package/dist/lib/obsidian/@types/Dataview/data-import/web-worker/import-entry.d.mts +1 -1
- package/dist/lib/obsidian/@types/Dataview/data-import/web-worker/import-impl.d.mts +1 -6
- package/dist/lib/obsidian/@types/Dataview/data-import/web-worker/import-manager.d.mts +1 -37
- package/dist/lib/obsidian/@types/Dataview/data-index/index.d.mts +1 -186
- package/dist/lib/obsidian/@types/Dataview/data-index/resolver.d.mts +1 -23
- package/dist/lib/obsidian/@types/Dataview/data-index/source.d.mts +1 -71
- package/dist/lib/obsidian/@types/Dataview/data-model/markdown.d.mts +1 -115
- package/dist/lib/obsidian/@types/Dataview/data-model/serialized/markdown.d.mts +1 -106
- package/dist/lib/obsidian/@types/Dataview/data-model/transferable.d.mts +1 -7
- package/dist/lib/obsidian/@types/Dataview/data-model/value.d.mts +1 -175
- package/dist/lib/obsidian/@types/Dataview/expression/binaryop.d.mts +1 -43
- package/dist/lib/obsidian/@types/Dataview/expression/context.d.mts +1 -49
- package/dist/lib/obsidian/@types/Dataview/expression/field.d.mts +1 -82
- package/dist/lib/obsidian/@types/Dataview/expression/functions.d.mts +1 -149
- package/dist/lib/obsidian/@types/Dataview/expression/parse.d.mts +1 -163
- package/dist/lib/obsidian/@types/Dataview/index.d.mts +1 -55
- package/dist/lib/obsidian/@types/Dataview/main.d.mts +1 -52
- package/dist/lib/obsidian/@types/Dataview/query/engine.d.mts +1 -103
- package/dist/lib/obsidian/@types/Dataview/query/parse.d.mts +1 -44
- package/dist/lib/obsidian/@types/Dataview/query/query.d.mts +1 -95
- package/dist/lib/obsidian/@types/Dataview/settings.d.mts +1 -60
- package/dist/lib/obsidian/@types/Dataview/typings/obsidian-ex.d.mts +1 -28
- package/dist/lib/obsidian/@types/Dataview/typings/workers.d.mts +1 -4
- package/dist/lib/obsidian/@types/Dataview/ui/export/markdown.d.mts +1 -15
- package/dist/lib/obsidian/@types/Dataview/ui/lp-render.d.mts +1 -37
- package/dist/lib/obsidian/@types/Dataview/ui/markdown.d.mts +1 -86
- package/dist/lib/obsidian/@types/Dataview/ui/refreshable-view.d.mts +1 -18
- package/dist/lib/obsidian/@types/Dataview/ui/render.d.mts +1 -33
- package/dist/lib/obsidian/@types/Dataview/ui/views/calendar-view.d.mts +1 -17
- package/dist/lib/obsidian/@types/Dataview/ui/views/inline-field-live-preview.d.mts +1 -42
- package/dist/lib/obsidian/@types/Dataview/ui/views/inline-view.d.mts +1 -28
- package/dist/lib/obsidian/@types/Dataview/ui/views/js-view.d.mts +1 -23
- package/dist/lib/obsidian/@types/Dataview/ui/views/list-view.d.mts +1 -25
- package/dist/lib/obsidian/@types/Dataview/ui/views/table-view.d.mts +1 -28
- package/dist/lib/obsidian/@types/Dataview/ui/views/task-view.d.mts +1 -51
- package/dist/lib/obsidian/@types/Dataview/util/hash.d.mts +1 -1
- package/dist/lib/obsidian/@types/Dataview/util/locale.d.mts +1 -2
- package/dist/lib/obsidian/@types/Dataview/util/media.d.mts +1 -6
- package/dist/lib/obsidian/@types/Dataview/util/normalize.d.mts +1 -44
- package/dist/lib/obsidian/App.d.mts +1 -30
- package/dist/lib/obsidian/AttachmentPath.d.mts +1 -54
- package/dist/lib/obsidian/Backlink.d.mts +1 -60
- package/dist/lib/obsidian/Callout.d.mts +1 -55
- package/dist/lib/obsidian/Components/DateComponent.d.mts +1 -36
- package/dist/lib/obsidian/Components/DateTimeComponent.d.mts +1 -36
- package/dist/lib/obsidian/Components/EmailComponent.d.mts +1 -29
- package/dist/lib/obsidian/Components/FileComponent.d.mts +1 -41
- package/dist/lib/obsidian/Components/MonthComponent.d.mts +1 -49
- package/dist/lib/obsidian/Components/MultipleDropdownComponent.d.mts +1 -73
- package/dist/lib/obsidian/Components/MultipleEmailComponent.d.mts +1 -36
- package/dist/lib/obsidian/Components/MultipleFileComponent.d.mts +1 -41
- package/dist/lib/obsidian/Components/MultipleTextComponent.d.mts +1 -67
- package/dist/lib/obsidian/Components/NumberComponent.d.mts +1 -29
- package/dist/lib/obsidian/Components/TimeComponent.d.mts +1 -37
- package/dist/lib/obsidian/Components/TypedRangeTextComponent.d.mts +1 -31
- package/dist/lib/obsidian/Components/TypedTextComponent.d.mts +1 -84
- package/dist/lib/obsidian/Components/UrlComponent.d.mts +1 -29
- package/dist/lib/obsidian/Components/ValidatorComponent.d.mts +1 -22
- package/dist/lib/obsidian/Components/ValueComponentWithChangeTracking.d.mts +1 -17
- package/dist/lib/obsidian/Components/WeekComponent.d.mts +1 -49
- package/dist/lib/obsidian/Components/index.d.mts +1 -17
- package/dist/lib/obsidian/Dataview.d.mts +1 -215
- package/dist/lib/obsidian/DataviewLink.d.mts +1 -23
- package/dist/lib/obsidian/FileChange.d.mts +1 -68
- package/dist/lib/obsidian/FileManager.d.mts +1 -38
- package/dist/lib/obsidian/FileSystem.d.mts +1 -185
- package/dist/lib/obsidian/Frontmatter.d.mts +1 -69
- package/dist/lib/obsidian/Link.d.mts +1 -366
- package/dist/lib/obsidian/Logger.d.mts +1 -13
- package/dist/lib/obsidian/Loop.d.mts +1 -36
- package/dist/lib/obsidian/Markdown.d.mts +1 -24
- package/dist/lib/obsidian/MarkdownCodeBlockProcessor.d.mts +1 -23
- package/dist/lib/obsidian/MarkdownView.d.mts +1 -12
- package/dist/lib/obsidian/MetadataCache.d.mts +1 -87
- package/dist/lib/obsidian/Modals/Alert.d.mts +1 -39
- package/dist/lib/obsidian/Modals/Confirm.d.mts +1 -43
- package/dist/lib/obsidian/Modals/ModalBase.d.mts +1 -35
- package/dist/lib/obsidian/Modals/Prompt.d.mts +1 -50
- package/dist/lib/obsidian/Modals/SelectItem.d.mts +1 -41
- package/dist/lib/obsidian/Modals/index.d.mts +1 -5
- package/dist/lib/obsidian/ObsidianSettings.d.mts +1 -17
- package/dist/lib/obsidian/Pdf.d.mts +1 -24
- package/dist/lib/obsidian/Plugin/EmptySettings.d.mts +1 -14
- package/dist/lib/obsidian/Plugin/ObsidianPluginRepoPaths.d.mts +1 -55
- package/dist/lib/obsidian/Plugin/Plugin.d.mts +1 -21
- package/dist/lib/obsidian/Plugin/PluginBase.d.mts +1 -108
- package/dist/lib/obsidian/Plugin/PluginContext.d.mts +1 -12
- package/dist/lib/obsidian/Plugin/PluginId.d.mts +1 -20
- package/dist/lib/obsidian/Plugin/PluginSettingsBase.d.mts +1 -31
- package/dist/lib/obsidian/Plugin/PluginSettingsTabBase.d.mts +1 -99
- package/dist/lib/obsidian/Plugin/index.d.mts +1 -8
- package/dist/lib/obsidian/Queue.d.mts +1 -30
- package/dist/lib/obsidian/Reference.d.mts +1 -21
- package/dist/lib/obsidian/RenameDeleteHandler.d.mts +1 -49
- package/dist/lib/obsidian/ResourceUrl.d.mts +1 -14
- package/dist/lib/obsidian/SettingEx.d.mts +1 -124
- package/dist/lib/obsidian/Vault.d.mts +1 -130
- package/dist/lib/obsidian/VaultEx.d.mts +1 -27
- package/dist/lib/obsidian/index.d.mts +1 -29
- package/dist/lib/url.d.mts +1 -11
- package/package.json +7 -7
package/dist/lib/Object.d.mts
CHANGED
@@ -1,211 +1 @@
|
|
1
|
-
|
2
|
-
* @packageDocumentation Object
|
3
|
-
* Contains utility functions for Objects.
|
4
|
-
*/
|
5
|
-
import type { UndefinedOnPartialDeep } from 'type-fest';
|
6
|
-
/**
|
7
|
-
* Specifies how functions should be handled in the JSON output.
|
8
|
-
*/
|
9
|
-
export declare enum FunctionHandlingMode {
|
10
|
-
/**
|
11
|
-
* Excludes functions from the JSON output.
|
12
|
-
*/
|
13
|
-
Exclude = "exclude",
|
14
|
-
/**
|
15
|
-
* Includes the full function definition in the JSON output.
|
16
|
-
*/
|
17
|
-
Full = "full",
|
18
|
-
/**
|
19
|
-
* Includes only the function name in the JSON output.
|
20
|
-
*/
|
21
|
-
NameOnly = "nameOnly"
|
22
|
-
}
|
23
|
-
/**
|
24
|
-
* Represents a constructor type for a given class `T` with arguments `Args`.
|
25
|
-
*
|
26
|
-
* @typeParam Type - The type of the instance being constructed.
|
27
|
-
* @typeParam Args - The types of arguments the constructor accepts.
|
28
|
-
*/
|
29
|
-
export type Constructor<Type, Args extends unknown[] = []> = new (...args: Args) => Type;
|
30
|
-
/**
|
31
|
-
* Extracts the keys of a given type `Type` that match a specific value type `Value`.
|
32
|
-
*
|
33
|
-
* @typeParam Type - The type from which to extract the keys.
|
34
|
-
* @typeParam Value - The value type to match against.
|
35
|
-
*/
|
36
|
-
export type KeysMatching<Type, Value> = {
|
37
|
-
[Key in keyof Type]-?: Type[Key] extends Value ? Key : never;
|
38
|
-
}[keyof Type];
|
39
|
-
/**
|
40
|
-
* Options for converting an object to JSON.
|
41
|
-
*/
|
42
|
-
export interface ToJsonOptions {
|
43
|
-
/**
|
44
|
-
* Specifies how functions should be handled in the JSON output (default: `exclude`).
|
45
|
-
*/
|
46
|
-
functionHandlingMode: FunctionHandlingMode;
|
47
|
-
/**
|
48
|
-
* Specifies the maximum depth of nested objects to include in the JSON output.
|
49
|
-
* Use `-1` for no limit.
|
50
|
-
* Defaults to `-1`.
|
51
|
-
*/
|
52
|
-
maxDepth: number;
|
53
|
-
/**
|
54
|
-
* Specifies whether to catch errors in `toJSON()` and replace them with a placeholder.
|
55
|
-
* Defaults to `false`.
|
56
|
-
*/
|
57
|
-
shouldCatchToJSONErrors: boolean;
|
58
|
-
/**
|
59
|
-
* Specifies whether to handle circular references in the JSON output.
|
60
|
-
* Defaults to `false`.
|
61
|
-
*/
|
62
|
-
shouldHandleCircularReferences: boolean;
|
63
|
-
/**
|
64
|
-
* Specifies whether to handle errors in the JSON output.
|
65
|
-
* Defaults to `false`.
|
66
|
-
*/
|
67
|
-
shouldHandleErrors: boolean;
|
68
|
-
/**
|
69
|
-
* Specifies whether to handle undefined values in the JSON output.
|
70
|
-
* Defaults to `false`.
|
71
|
-
*/
|
72
|
-
shouldHandleUndefined: boolean;
|
73
|
-
/**
|
74
|
-
* Specifies whether to sort the keys of the JSON output.
|
75
|
-
* Defaults to `false`.
|
76
|
-
*/
|
77
|
-
shouldSortKeys: boolean;
|
78
|
-
/**
|
79
|
-
* Specifies the indentation of the JSON output. This can be a number of spaces or a string. Defaults to `2`.
|
80
|
-
*/
|
81
|
-
space: number | string;
|
82
|
-
/**
|
83
|
-
* Specifies the substitutions to use in the JSON output.
|
84
|
-
*/
|
85
|
-
tokenSubstitutions: Partial<TokenSubstitutions>;
|
86
|
-
}
|
87
|
-
interface TokenSubstitutions {
|
88
|
-
circularReference: string;
|
89
|
-
maxDepthLimitReached: string;
|
90
|
-
toJSONFailed: string;
|
91
|
-
}
|
92
|
-
/**
|
93
|
-
* Assigns properties from one or more source objects to a target object, including non-enumerable properties.
|
94
|
-
*
|
95
|
-
* @param target - The target object to assign properties to.
|
96
|
-
* @param source - The source object to assign properties from.
|
97
|
-
* @returns The target object with the assigned properties.
|
98
|
-
*/
|
99
|
-
export declare function assignWithNonEnumerableProperties<T extends object, U>(target: T, source: U): T & U;
|
100
|
-
/**
|
101
|
-
* @param target - The target object to assign properties to.
|
102
|
-
* @param source1 - The first source object to assign properties from.
|
103
|
-
* @param source2 - The second source object to assign properties from.
|
104
|
-
* @returns The target object with the assigned properties.
|
105
|
-
*/
|
106
|
-
export declare function assignWithNonEnumerableProperties<T extends object, U, V>(target: T, source1: U, source2: V): T & U & V;
|
107
|
-
/**
|
108
|
-
* Assigns properties from one or more source objects to a target object, including non-enumerable properties.
|
109
|
-
*
|
110
|
-
* @param target - The target object to assign properties to.
|
111
|
-
* @param source1 - The first source object to assign properties from.
|
112
|
-
* @param source2 - The second source object to assign properties from.
|
113
|
-
* @param source3 - The third source object to assign properties from.
|
114
|
-
* @returns The target object with the assigned properties.
|
115
|
-
*/
|
116
|
-
export declare function assignWithNonEnumerableProperties<T extends object, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
|
117
|
-
/**
|
118
|
-
* Clones an object, including non-enumerable properties.
|
119
|
-
*
|
120
|
-
* @param obj - The object to clone.
|
121
|
-
* @returns A new object with the same properties as the original object, including non-enumerable properties.
|
122
|
-
*/
|
123
|
-
export declare function cloneWithNonEnumerableProperties<T extends object>(obj: T): T;
|
124
|
-
/**
|
125
|
-
* Compares two values to determine if they are deeply equal.
|
126
|
-
*
|
127
|
-
* @param a - The first value to compare.
|
128
|
-
* @param b - The second value to compare.
|
129
|
-
* @returns `true` if the values are deeply equal, otherwise `false`.
|
130
|
-
*/
|
131
|
-
export declare function deepEqual(a: unknown, b: unknown): boolean;
|
132
|
-
/**
|
133
|
-
* Deletes multiple properties from an object.
|
134
|
-
*
|
135
|
-
* @typeParam T - The type of the object.
|
136
|
-
* @param obj - The object to delete the properties from.
|
137
|
-
* @param propertyNames - The names of the properties to delete.
|
138
|
-
* @returns `true` if any of the properties were present, otherwise `false`.
|
139
|
-
*/
|
140
|
-
export declare function deleteProperties<T extends object>(obj: T, propertyNames: (keyof T)[]): boolean;
|
141
|
-
/**
|
142
|
-
* Deletes a property from an object.
|
143
|
-
*
|
144
|
-
* @typeParam T - The type of the object.
|
145
|
-
* @param obj - The object to delete the property from.
|
146
|
-
* @param propertyName - The name of the property to delete.
|
147
|
-
* @returns `true` if the property was present, otherwise `false`.
|
148
|
-
*/
|
149
|
-
export declare function deleteProperty<T extends object>(obj: T, propertyName: keyof T): boolean;
|
150
|
-
/**
|
151
|
-
* Gets the value of a nested property from an object.
|
152
|
-
*
|
153
|
-
* @param obj - The object to get the nested property value from.
|
154
|
-
* @param path - The path to the nested property.
|
155
|
-
* @returns The value of the nested property.
|
156
|
-
*/
|
157
|
-
export declare function getNestedPropertyValue(obj: Record<string, unknown>, path: string): unknown;
|
158
|
-
/**
|
159
|
-
* Gets the prototype of the specified object.
|
160
|
-
*
|
161
|
-
* @typeParam T - The type of the object.
|
162
|
-
* @param instance - The object instance to retrieve the prototype of.
|
163
|
-
* @returns The prototype of the object.
|
164
|
-
*/
|
165
|
-
export declare function getPrototypeOf<T>(instance: T): T;
|
166
|
-
/**
|
167
|
-
* Retrieves the name of a property of a given type `T`.
|
168
|
-
*
|
169
|
-
* @typeParam T - The type of the object containing the property.
|
170
|
-
* @param name - The name of the property as a string.
|
171
|
-
* @returns The name of the property.
|
172
|
-
*/
|
173
|
-
export declare function nameof<T>(name: Extract<keyof T, string>): string;
|
174
|
-
/**
|
175
|
-
* Normalizes optional properties to allow `undefined` assignment in strict mode.
|
176
|
-
*
|
177
|
-
* This utility provides a workaround for the `exactOptionalPropertyTypes` TypeScript flag,
|
178
|
-
* which prohibits directly assigning `undefined` to optional properties when the type
|
179
|
-
* explicitly omits `undefined`.
|
180
|
-
*
|
181
|
-
* Example:
|
182
|
-
* ```typescript
|
183
|
-
* // With `exactOptionalPropertyTypes: true`
|
184
|
-
* const x: { prop?: string } = { prop: undefined }; // Compiler error
|
185
|
-
*
|
186
|
-
* // Using this utility:
|
187
|
-
* const y: { prop?: string } = normalizeOptionalProperties<{ prop?: string }>({ prop: undefined }); // Works
|
188
|
-
* ```
|
189
|
-
*
|
190
|
-
* @typeParam T - The target type with optional properties to normalize.
|
191
|
-
* @param obj - The object to normalize, allowing explicit `undefined` for optional properties.
|
192
|
-
* @returns The normalized object, compatible with `exactOptionalPropertyTypes`.
|
193
|
-
*/
|
194
|
-
export declare function normalizeOptionalProperties<T>(obj: UndefinedOnPartialDeep<T>): T;
|
195
|
-
/**
|
196
|
-
* Sets the value of a nested property in an object.
|
197
|
-
*
|
198
|
-
* @param obj - The object to set the nested property value in.
|
199
|
-
* @param path - The path to the nested property.
|
200
|
-
* @param value - The value to set.
|
201
|
-
*/
|
202
|
-
export declare function setNestedPropertyValue(obj: Record<string, unknown>, path: string, value: unknown): void;
|
203
|
-
/**
|
204
|
-
* Converts a given value to a JSON string.
|
205
|
-
*
|
206
|
-
* @param value - The value to be converted to JSON. This can be of any type.
|
207
|
-
* @param options - Options for customizing the JSON conversion process.
|
208
|
-
* @returns The JSON string representation of the input value.
|
209
|
-
*/
|
210
|
-
export declare function toJson(value: unknown, options?: Partial<ToJsonOptions>): string;
|
211
|
-
export {};
|
1
|
+
export * from './Object.cjs';
|
package/dist/lib/Path.d.mts
CHANGED
@@ -1,133 +1 @@
|
|
1
|
-
|
2
|
-
* @packageDocumentation Path
|
3
|
-
* Contains utility functions for handling paths.
|
4
|
-
*/
|
5
|
-
import pathBrowserify from 'path-browserify';
|
6
|
-
/**
|
7
|
-
* Provides methods for handling POSIX paths.
|
8
|
-
*/
|
9
|
-
export declare const posix: pathBrowserify.Path;
|
10
|
-
/**
|
11
|
-
* The POSIX path delimiter.
|
12
|
-
*/
|
13
|
-
export declare const delimiter: string;
|
14
|
-
/**
|
15
|
-
* The POSIX segment separator.
|
16
|
-
*/
|
17
|
-
export declare const sep: string;
|
18
|
-
/**
|
19
|
-
* Returns the base name of a file, optionally removing the file extension.
|
20
|
-
*
|
21
|
-
* @param path - The path to get the base name from.
|
22
|
-
* @param ext - An optional extension to remove from the base name.
|
23
|
-
* @returns The base name of the file.
|
24
|
-
*/
|
25
|
-
export declare const basename: (this: void, path: string, ext?: string) => string;
|
26
|
-
/**
|
27
|
-
* Returns the directory name of a path.
|
28
|
-
*
|
29
|
-
* @param path - The path to get the directory name from.
|
30
|
-
* @returns The directory name of the path.
|
31
|
-
*/
|
32
|
-
export declare const dirname: (this: void, path: string) => string;
|
33
|
-
/**
|
34
|
-
* Returns the file extension of a path.
|
35
|
-
*
|
36
|
-
* @param path - The path to get the extension from.
|
37
|
-
* @returns The file extension of the path.
|
38
|
-
*/
|
39
|
-
export declare const extname: (this: void, path: string) => string;
|
40
|
-
/**
|
41
|
-
* Formats a path object into a path string.
|
42
|
-
*
|
43
|
-
* @param pathObject - The path object to format.
|
44
|
-
* @returns The formatted path string.
|
45
|
-
*/
|
46
|
-
export declare const format: (this: void, pathObject: Partial<pathBrowserify.PathObject>) => string;
|
47
|
-
/**
|
48
|
-
* Determines if a path is absolute.
|
49
|
-
*
|
50
|
-
* @param path - The path to check.
|
51
|
-
* @returns `true` if the path is absolute, `false` otherwise.
|
52
|
-
*/
|
53
|
-
export declare function isAbsolute(path: string): boolean;
|
54
|
-
/**
|
55
|
-
* Joins multiple path segments into a single path.
|
56
|
-
*
|
57
|
-
* @param paths - The path segments to join.
|
58
|
-
* @returns The joined path.
|
59
|
-
*/
|
60
|
-
export declare const join: (this: void, ...paths: string[]) => string;
|
61
|
-
/**
|
62
|
-
* Normalizes a path, resolving '..' and '.' segments.
|
63
|
-
*
|
64
|
-
* @param path - The path to normalize.
|
65
|
-
* @returns The normalized path.
|
66
|
-
*/
|
67
|
-
export declare const normalize: (this: void, path: string) => string;
|
68
|
-
/**
|
69
|
-
* Parses a path string into a path object.
|
70
|
-
*
|
71
|
-
* @param path - The path string to parse.
|
72
|
-
* @returns The parsed path object.
|
73
|
-
*/
|
74
|
-
export declare const parse: (this: void, path: string) => pathBrowserify.PathObject;
|
75
|
-
/**
|
76
|
-
* Returns the relative path from one path to another.
|
77
|
-
*
|
78
|
-
* @param from - The starting path.
|
79
|
-
* @param to - The destination path.
|
80
|
-
* @returns The relative path from `from` to `to`.
|
81
|
-
*/
|
82
|
-
export declare const relative: (this: void, from: string, to: string) => string;
|
83
|
-
/**
|
84
|
-
* Gets the directory name from the `import(dot)meta(dot)url`, converting it to a POSIX-style path.
|
85
|
-
*
|
86
|
-
* @param importMetaUrl - The `import(dot)meta(dot)url` from which to extract the directory name.
|
87
|
-
* @returns The POSIX-style directory name.
|
88
|
-
*/
|
89
|
-
export declare function getDirname(importMetaUrl: string): string;
|
90
|
-
/**
|
91
|
-
* Gets the filename from the `import(dot)meta(dot)url`, converting it to a POSIX-style path.
|
92
|
-
*
|
93
|
-
* @param importMetaUrl - The `import(dot)meta(dot)url` from which to extract the filename.
|
94
|
-
* @returns The POSIX-style filename.
|
95
|
-
*/
|
96
|
-
export declare function getFilename(importMetaUrl: string): string;
|
97
|
-
/**
|
98
|
-
* Makes a filename by appending an extension to a given filename.
|
99
|
-
* If the extension is empty, the filename is returned as is.
|
100
|
-
*
|
101
|
-
* @param fileName - The filename to append the extension to.
|
102
|
-
* @param extension - The extension to append to the filename.
|
103
|
-
* @returns The filename with the extension appended.
|
104
|
-
*/
|
105
|
-
export declare function makeFileName(fileName: string, extension: string): string;
|
106
|
-
/**
|
107
|
-
* Normalizes a given path by ensuring it is relative, adding "./" if necessary.
|
108
|
-
*
|
109
|
-
* @param path - The path to normalize.
|
110
|
-
* @returns The normalized path, starting with "./" if it was relative.
|
111
|
-
*/
|
112
|
-
export declare function normalizeIfRelative(path: string): string;
|
113
|
-
/**
|
114
|
-
* Resolves a sequence of paths or path segments into an absolute path.
|
115
|
-
*
|
116
|
-
* @param pathSegments - The sequence of path segments to resolve.
|
117
|
-
* @returns The resolved absolute path.
|
118
|
-
*/
|
119
|
-
export declare function resolve(...pathSegments: string[]): string;
|
120
|
-
/**
|
121
|
-
* Converts a buffer containing a path to a POSIX-style buffer by replacing backslashes with forward slashes.
|
122
|
-
*
|
123
|
-
* @param buffer - The buffer to convert.
|
124
|
-
* @returns A new buffer containing the POSIX-style path.
|
125
|
-
*/
|
126
|
-
export declare function toPosixBuffer(buffer: Buffer): Buffer;
|
127
|
-
/**
|
128
|
-
* Converts a given path to a POSIX-style path by replacing backslashes with forward slashes.
|
129
|
-
*
|
130
|
-
* @param path - The path to convert.
|
131
|
-
* @returns The POSIX-style path.
|
132
|
-
*/
|
133
|
-
export declare function toPosixPath(path: string): string;
|
1
|
+
export * from './Path.cjs';
|
package/dist/lib/RegExp.d.mts
CHANGED
@@ -1,18 +1 @@
|
|
1
|
-
|
2
|
-
* @packageDocumentation RegExp
|
3
|
-
* Contains utility functions for regular expressions.
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* Escapes special characters in a string to safely use it within a regular expression.
|
7
|
-
*
|
8
|
-
* @param str - The string to escape.
|
9
|
-
* @returns The escaped string with special characters prefixed with a backslash.
|
10
|
-
*/
|
11
|
-
export declare function escapeRegExp(str: string): string;
|
12
|
-
/**
|
13
|
-
* Checks if a string is a valid regular expression.
|
14
|
-
*
|
15
|
-
* @param str - The string to check.
|
16
|
-
* @returns `true` if the string is a valid regular expression, `false` otherwise.
|
17
|
-
*/
|
18
|
-
export declare function isValidRegExp(str: string): boolean;
|
1
|
+
export * from './RegExp.cjs';
|
@@ -1,70 +1 @@
|
|
1
|
-
|
2
|
-
* @packageDocumentation cli
|
3
|
-
* Contains utility classes and functions for managing task results, including
|
4
|
-
* success, exit codes, and chaining multiple tasks.
|
5
|
-
*/
|
6
|
-
import type { MaybePromise } from '../Async.mjs';
|
7
|
-
/**
|
8
|
-
* Abstract class representing the result of a task. Includes methods for handling success,
|
9
|
-
* exit codes, and chaining tasks.
|
10
|
-
*/
|
11
|
-
export declare abstract class CliTaskResult {
|
12
|
-
/**
|
13
|
-
* Chains multiple tasks together, executing them sequentially until one fails.
|
14
|
-
*
|
15
|
-
* @param tasks - An array of task functions that return a `TaskResult` or `void`.
|
16
|
-
* @returns A promise that resolves with the first failed `TaskResult` or a success result.
|
17
|
-
*/
|
18
|
-
static chain(tasks: (() => MaybePromise<CliTaskResult | void>)[]): Promise<CliTaskResult>;
|
19
|
-
/**
|
20
|
-
* Creates a `TaskResult` that does not exit the process.
|
21
|
-
*
|
22
|
-
* @returns A `TaskResult` that does not exit the process.
|
23
|
-
*/
|
24
|
-
static DoNotExit(): CliTaskResult;
|
25
|
-
/**
|
26
|
-
* Represents a failure result of a CLI task.
|
27
|
-
*
|
28
|
-
* @returns The failure result.
|
29
|
-
*/
|
30
|
-
static Failure(): CliTaskResult;
|
31
|
-
/**
|
32
|
-
* Creates a `TaskResult` based on an exit code.
|
33
|
-
*
|
34
|
-
* @param exitCode - The exit code to represent.
|
35
|
-
* @returns A `TaskResult` representing the exit code.
|
36
|
-
*/
|
37
|
-
static FromExitCode(exitCode: number): CliTaskResult;
|
38
|
-
/**
|
39
|
-
* Creates a CliTaskResult representing a successful task result.
|
40
|
-
*
|
41
|
-
* @param isSuccess - A boolean indicating whether the task was successful. Default is true.
|
42
|
-
* @returns A CliTaskResult object representing a successful task result.
|
43
|
-
*/
|
44
|
-
static Success(isSuccess?: boolean): CliTaskResult;
|
45
|
-
/**
|
46
|
-
* Exits the process based on the task result.
|
47
|
-
*/
|
48
|
-
abstract exit(): void;
|
49
|
-
/**
|
50
|
-
* Determines if the task was successful.
|
51
|
-
*
|
52
|
-
* @returns `true` if the task was successful, otherwise `false`.
|
53
|
-
*/
|
54
|
-
protected abstract isSuccessful(): boolean;
|
55
|
-
}
|
56
|
-
/**
|
57
|
-
* Converts an array of command-line arguments into a single command-line string.
|
58
|
-
* Handles escaping of special characters such as spaces, quotes, and newlines.
|
59
|
-
*
|
60
|
-
* @param args - The array of command-line arguments to convert.
|
61
|
-
* @returns A string representing the command-line invocation.
|
62
|
-
*/
|
63
|
-
export declare function toCommandLine(args: string[]): string;
|
64
|
-
/**
|
65
|
-
* Wraps a CLI task function to ensure it runs safely and handles its `TaskResult`.
|
66
|
-
*
|
67
|
-
* @param taskFn - The task function to execute, which may return a `TaskResult` or void.
|
68
|
-
* @returns A promise that resolves when the task is completed and exits with the appropriate status.
|
69
|
-
*/
|
70
|
-
export declare function wrapCliTask(taskFn: () => MaybePromise<CliTaskResult | void>): Promise<void>;
|
1
|
+
export * from './CliUtils.cjs';
|
@@ -1,12 +1 @@
|
|
1
|
-
|
2
|
-
* @packageDocumentation CodeGenerator
|
3
|
-
* Contains utility functions for code generation.
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* Generates a file at the specified path with the provided lines of code.
|
7
|
-
*
|
8
|
-
* @param path - The path where the file will be generated.
|
9
|
-
* @param lines - An array of strings representing the lines of code to be written in the file.
|
10
|
-
* @returns A promise that resolves when the file generation is complete.
|
11
|
-
*/
|
12
|
-
export declare function generate(path: string, lines: string[]): Promise<void>;
|
1
|
+
export * from './CodeGenerator.cjs';
|
@@ -1,13 +1 @@
|
|
1
|
-
|
2
|
-
* @packageDocumentation \@guardian/eslint-plugin-tsdoc-required
|
3
|
-
* @see {@link https://www.npmjs.com/package/@guardian/eslint-plugin-tsdoc-required} for more information.
|
4
|
-
*/
|
5
|
-
|
6
|
-
declare module '@guardian/eslint-plugin-tsdoc-required' {
|
7
|
-
import type { ESLint } from 'eslint';
|
8
|
-
|
9
|
-
const plugin: ESLint.Plugin;
|
10
|
-
|
11
|
-
// eslint-disable-next-line import-x/no-default-export
|
12
|
-
export default plugin;
|
13
|
-
}
|
1
|
+
export * from './@guardian__eslint-plugin-tsdoc-required.cjs';
|
@@ -1,13 +1 @@
|
|
1
|
-
|
2
|
-
* @packageDocumentation eslint-plugin-modules-newlines
|
3
|
-
* @see {@link https://www.npmjs.com/package/eslint-plugin-modules-newlines} for more information.
|
4
|
-
*/
|
5
|
-
|
6
|
-
declare module 'eslint-plugin-modules-newlines' {
|
7
|
-
import type { ESLint } from 'eslint';
|
8
|
-
|
9
|
-
const plugin: ESLint.Plugin;
|
10
|
-
|
11
|
-
// eslint-disable-next-line import-x/no-default-export
|
12
|
-
export default plugin;
|
13
|
-
}
|
1
|
+
export * from './eslint-plugin-modules-newlines.cjs';
|
@@ -1,13 +1 @@
|
|
1
|
-
|
2
|
-
* @packageDocumentation eslint-plugin-verify-tsdoc
|
3
|
-
* @see {@link https://www.npmjs.com/package/eslint-plugin-verify-tsdoc} for more information.
|
4
|
-
*/
|
5
|
-
|
6
|
-
declare module 'eslint-plugin-verify-tsdoc' {
|
7
|
-
import type { ESLint } from 'eslint';
|
8
|
-
|
9
|
-
const plugin: ESLint.Plugin;
|
10
|
-
|
11
|
-
// eslint-disable-next-line import-x/no-default-export
|
12
|
-
export default plugin;
|
13
|
-
}
|
1
|
+
export * from './eslint-plugin-verify-tsdoc.cjs';
|
@@ -1,13 +1 @@
|
|
1
|
-
|
2
|
-
* @packageDocumentation ESLint
|
3
|
-
* Linting utility for ESLint configuration with support for automatic fixing.
|
4
|
-
*
|
5
|
-
* This module provides a function to lint files based on the ESLint configuration defined in `eslint.config.ts`.
|
6
|
-
* It can automatically fix linting issues if specified, and logs results to the console.
|
7
|
-
*/
|
8
|
-
/**
|
9
|
-
* Lint the project with ESLint.
|
10
|
-
*
|
11
|
-
* @param shouldFix - Whether to fix linting issues automatically.
|
12
|
-
*/
|
13
|
-
export declare function lint(shouldFix?: boolean): Promise<void>;
|
1
|
+
export * from './ESLint.cjs';
|
@@ -1,16 +1 @@
|
|
1
|
-
|
2
|
-
* @packageDocumentation eslint.config
|
3
|
-
* ESLint configuration for TypeScript projects with various plugins.
|
4
|
-
*
|
5
|
-
* This module exports ESLint configurations for TypeScript projects, integrating multiple ESLint plugins
|
6
|
-
* such as `@typescript-eslint/parser`, `@typescript-eslint/eslint-plugin`,
|
7
|
-
* `eslint-plugin-modules-newlines`, `@stylistic/eslint-plugin`.
|
8
|
-
* It sets up parsers, plugins, and rules for maintaining code quality and consistency.
|
9
|
-
*
|
10
|
-
* @packageDocumentation eslint-config
|
11
|
-
*/
|
12
|
-
import type { Linter } from 'eslint';
|
13
|
-
/**
|
14
|
-
* The ESLint configurations for TypeScript projects.
|
15
|
-
*/
|
16
|
-
export declare const configs: Linter.Config[];
|
1
|
+
export * from './eslint.config.cjs';
|
@@ -1,2 +1 @@
|
|
1
|
-
export *
|
2
|
-
export * as ESLint from './ESLint.mjs';
|
1
|
+
export * from './index.cjs';
|
@@ -1,83 +1 @@
|
|
1
|
-
|
2
|
-
* @packageDocumentation Exec
|
3
|
-
* Contains utility functions for executing commands.
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* Options for executing a command.
|
7
|
-
*/
|
8
|
-
export interface ExecOption {
|
9
|
-
/**
|
10
|
-
* The current working directory for the command execution.
|
11
|
-
*/
|
12
|
-
cwd?: string;
|
13
|
-
/**
|
14
|
-
* If true, suppresses the output of the command.
|
15
|
-
*/
|
16
|
-
isQuiet?: boolean;
|
17
|
-
/**
|
18
|
-
* If true, throws an error if the command fails.
|
19
|
-
*/
|
20
|
-
shouldFailIfCalledFromOutsideRoot?: boolean;
|
21
|
-
/**
|
22
|
-
* If true, ignores the exit code of the command.
|
23
|
-
*/
|
24
|
-
shouldIgnoreExitCode?: boolean;
|
25
|
-
/**
|
26
|
-
* If false, only returns the output of the command.
|
27
|
-
*/
|
28
|
-
shouldIncludeDetails?: boolean;
|
29
|
-
/**
|
30
|
-
* The input to be passed to the command.
|
31
|
-
*/
|
32
|
-
stdin?: string;
|
33
|
-
}
|
34
|
-
/**
|
35
|
-
* Represents the result of executing a command.
|
36
|
-
*/
|
37
|
-
export interface ExecResult {
|
38
|
-
/**
|
39
|
-
* The exit code of the command. A value of `null` indicates that the process did not exit normally.
|
40
|
-
*/
|
41
|
-
exitCode: null | number;
|
42
|
-
/**
|
43
|
-
* The signal that caused the process to be terminated. A value of `null` indicates that no signal was received.
|
44
|
-
*/
|
45
|
-
exitSignal: NodeJS.Signals | null;
|
46
|
-
/**
|
47
|
-
* The standard error output from the command.
|
48
|
-
*/
|
49
|
-
stderr: string;
|
50
|
-
/**
|
51
|
-
* The standard output from the command.
|
52
|
-
*/
|
53
|
-
stdout: string;
|
54
|
-
}
|
55
|
-
/**
|
56
|
-
* Executes a command.
|
57
|
-
*
|
58
|
-
* @param command - The command to execute. It can be a string or an array of strings.
|
59
|
-
* @param options - The options for the execution.
|
60
|
-
* @returns A Promise that resolves with the output of the command.
|
61
|
-
* @throws If the command fails with a non-zero exit code and ignoreExitCode is false.
|
62
|
-
* The error message includes the exit code and stderr.
|
63
|
-
* If an error occurs during the execution and ignoreExitCode is true,
|
64
|
-
* the error is resolved with the stdout and stderr.
|
65
|
-
*/
|
66
|
-
export declare function exec(command: string | string[], options?: {
|
67
|
-
withDetails?: false;
|
68
|
-
} & ExecOption): Promise<string>;
|
69
|
-
/**
|
70
|
-
* Executes a command.
|
71
|
-
*
|
72
|
-
* @param command - The command to execute. It can be a string or an array of strings.
|
73
|
-
* @param options - The options for the execution.
|
74
|
-
* @returns A Promise that resolves with ExecResult object.
|
75
|
-
* The ExecResult object contains the exit code, exit signal, stderr, and stdout.
|
76
|
-
* @throws If the command fails with a non-zero exit code and ignoreExitCode is false.
|
77
|
-
* The error message includes the exit code and stderr.
|
78
|
-
* If an error occurs during the execution and ignoreExitCode is true,
|
79
|
-
* the error is resolved with the stdout and stderr.
|
80
|
-
*/
|
81
|
-
export declare function exec(command: string | string[], options: {
|
82
|
-
withDetails: true;
|
83
|
-
} & ExecOption): Promise<ExecResult>;
|
1
|
+
export * from './Exec.cjs';
|