@tb-dev/prototype-dom 6.0.1 → 6.1.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/dist/index.d.ts +16 -23
- package/dist/index.js +202 -165
- package/package.json +4 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,35 +1,28 @@
|
|
|
1
1
|
declare global {
|
|
2
|
-
interface ArrayConstructor {
|
|
3
|
-
fromElements: <T extends Element[] | NodeList | string, V>(source: T, valueSelector: (element: Element) => V) => V[];
|
|
4
|
-
}
|
|
5
2
|
interface Document {
|
|
6
|
-
queryStrict: <T extends Element>(
|
|
7
|
-
queryAsArray: <T = Element>(selector: string,
|
|
8
|
-
queryAsSet: <T = Element>(selector: string,
|
|
9
|
-
queryAsMap: <T extends Element, K, V = T>(selector: string,
|
|
3
|
+
queryStrict: <T extends Element = Element>(selectors: string) => T;
|
|
4
|
+
queryAsArray: <T = Element>(selector: string, valueFn?: (element: Element) => T) => T[];
|
|
5
|
+
queryAsSet: <T = Element>(selector: string, valueFn?: (element: Element) => T) => Set<T>;
|
|
6
|
+
queryAsMap: <T extends Element, K, V = T>(selector: string, keyFn: (element: T) => K, valueFn?: (element: T) => V) => Map<K, V>;
|
|
7
|
+
waitChild: (selector: string, timeout?: number) => Promise<Element>;
|
|
10
8
|
}
|
|
11
9
|
interface Element {
|
|
12
|
-
getAttributeStrict:
|
|
13
|
-
getAttributeAsFloatStrict: (
|
|
14
|
-
getAttributeAsIntStrict: (
|
|
15
|
-
getTextStrict:
|
|
16
|
-
getTextAsIntStrict: (radix?: number
|
|
17
|
-
getTextAsFloatStrict: (
|
|
18
|
-
queryAsArray: <T = Element>(selector: string,
|
|
19
|
-
queryAsSet: <T = Element>(selector: string,
|
|
10
|
+
getAttributeStrict: (name: string) => string;
|
|
11
|
+
getAttributeAsFloatStrict: (name: string) => number;
|
|
12
|
+
getAttributeAsIntStrict: (name: string, radix?: number) => number;
|
|
13
|
+
getTextStrict: () => string;
|
|
14
|
+
getTextAsIntStrict: (radix?: number) => number;
|
|
15
|
+
getTextAsFloatStrict: () => number;
|
|
16
|
+
queryAsArray: <T = Element>(selector: string, valueFn?: (element: Element) => T) => T[];
|
|
17
|
+
queryAsSet: <T = Element>(selector: string, valueFn?: (element: Element) => T) => Set<T>;
|
|
20
18
|
queryStrict: <T extends Element>(selector: string) => T;
|
|
21
|
-
queryAsMap: <T extends Element, K, V = T>(selector: string,
|
|
19
|
+
queryAsMap: <T extends Element, K, V = T>(selector: string, keyFn: (element: T) => K, valueFn?: (element: T) => V) => Map<K, V>;
|
|
20
|
+
waitChild: (selector: string, timeout?: number) => Promise<Element>;
|
|
22
21
|
}
|
|
23
22
|
interface URLSearchParams {
|
|
24
|
-
getStrict:
|
|
23
|
+
getStrict: (name: string) => string;
|
|
25
24
|
getAsInteger: (name: string, radix?: number) => number | null;
|
|
26
25
|
getAsIntegerStrict: (name: string, radix?: number) => number;
|
|
27
26
|
}
|
|
28
|
-
interface MapConstructor {
|
|
29
|
-
fromElements: <T extends Element[] | NodeList | string, K, V>(source: T, keySelector: (element: Element) => K, valueSelector: (element: Element) => V) => Map<K, V>;
|
|
30
|
-
}
|
|
31
|
-
interface SetConstructor {
|
|
32
|
-
fromElements: <T extends Element[] | NodeList | string, K>(source: T, valueSelector: (element: Element) => K) => Set<K>;
|
|
33
|
-
}
|
|
34
27
|
}
|
|
35
28
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -1,175 +1,212 @@
|
|
|
1
1
|
(function () {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
Document.prototype.queryAsArray = function (selector, valueSelector) {
|
|
11
|
-
valueSelector ??= (element) => element;
|
|
12
|
-
const elements = this.querySelectorAll(selector);
|
|
13
|
-
return Array.from(elements, valueSelector);
|
|
14
|
-
};
|
|
15
|
-
Document.prototype.queryAsSet = function (selector, valueSelector) {
|
|
16
|
-
valueSelector ??= (element) => element;
|
|
17
|
-
const elements = this.queryAsArray(selector, valueSelector);
|
|
18
|
-
return new Set(elements);
|
|
19
|
-
};
|
|
20
|
-
Document.prototype.queryAsMap = function (selector, keySelector, valueSelector = (el) => el) {
|
|
21
|
-
const elements = this.queryAsArray(selector);
|
|
22
|
-
const map = new Map();
|
|
23
|
-
for (const element of elements) {
|
|
24
|
-
const key = keySelector(element);
|
|
25
|
-
const value = valueSelector(element);
|
|
26
|
-
map.set(key, value);
|
|
27
|
-
}
|
|
28
|
-
return map;
|
|
29
|
-
};
|
|
30
|
-
Element.prototype.getAttributeStrict = function (attribute) {
|
|
31
|
-
const value = this.getAttribute(attribute)?.trim();
|
|
32
|
-
if (typeof value !== 'string' || value.length === 0) {
|
|
33
|
-
throw new Error(`attribute "${attribute}" not found`);
|
|
34
|
-
}
|
|
35
|
-
return value;
|
|
36
|
-
};
|
|
37
|
-
Element.prototype.getAttributeAsFloatStrict = function (attribute) {
|
|
38
|
-
const value = this.getAttributeStrict(attribute);
|
|
39
|
-
const parsed = Number.parseFloat(value);
|
|
40
|
-
if (!Number.isFinite(parsed))
|
|
41
|
-
throw new Error(`could not parse attribute "${attribute}" as float`);
|
|
42
|
-
return parsed;
|
|
43
|
-
};
|
|
44
|
-
Element.prototype.getAttributeAsIntStrict = function (attribute, radix = 10) {
|
|
45
|
-
const value = this.getAttributeStrict(attribute);
|
|
46
|
-
const parsed = Number.parseInt(value.replace(/\D/g, ''), radix);
|
|
47
|
-
if (!Number.isInteger(parsed)) {
|
|
48
|
-
throw new TypeError(`could not parse attribute "${attribute}" as integer`);
|
|
49
|
-
}
|
|
50
|
-
return parsed;
|
|
51
|
-
};
|
|
52
|
-
Element.prototype.getTextStrict = function () {
|
|
53
|
-
const content = this.textContent?.trim();
|
|
54
|
-
if (typeof content !== 'string' || content.length === 0) {
|
|
55
|
-
throw new Error('element has no text content');
|
|
56
|
-
}
|
|
57
|
-
return content;
|
|
58
|
-
};
|
|
59
|
-
Element.prototype.getTextAsIntStrict = function (radix = 10) {
|
|
60
|
-
const content = this.getTextStrict();
|
|
61
|
-
const parsed = Number.parseInt(content.replace(/\D/g, ''), radix);
|
|
62
|
-
if (!Number.isInteger(parsed)) {
|
|
63
|
-
throw new TypeError('could not parse text content as integer');
|
|
64
|
-
}
|
|
65
|
-
return parsed;
|
|
66
|
-
};
|
|
67
|
-
Element.prototype.getTextAsFloatStrict = function () {
|
|
68
|
-
const content = this.getTextStrict();
|
|
69
|
-
const parsed = Number.parseFloat(content);
|
|
70
|
-
if (!Number.isFinite(parsed)) {
|
|
71
|
-
throw new TypeError('could not parse text content as float');
|
|
72
|
-
}
|
|
73
|
-
return parsed;
|
|
74
|
-
};
|
|
75
|
-
Element.prototype.queryStrict = function (selector) {
|
|
76
|
-
const element = this.querySelector(selector);
|
|
77
|
-
if (!element)
|
|
78
|
-
throw new Error(`no element found for selector "${selector}"`);
|
|
79
|
-
return element;
|
|
80
|
-
};
|
|
81
|
-
Element.prototype.queryAsArray = function (selector, valueSelector) {
|
|
82
|
-
valueSelector ??= (element) => element;
|
|
83
|
-
const elements = this.querySelectorAll(selector);
|
|
84
|
-
return Array.from(elements, valueSelector);
|
|
85
|
-
};
|
|
86
|
-
Element.prototype.queryAsSet = function (selector, valueSelector) {
|
|
87
|
-
valueSelector ??= (element) => element;
|
|
88
|
-
const elements = this.queryAsArray(selector, valueSelector);
|
|
89
|
-
return new Set(elements);
|
|
90
|
-
};
|
|
91
|
-
Element.prototype.queryAsMap = function (selector, keySelector, valueSelector = (el) => el) {
|
|
92
|
-
const elements = this.queryAsArray(selector);
|
|
93
|
-
const map = new Map();
|
|
94
|
-
for (const element of elements) {
|
|
95
|
-
const key = keySelector(element);
|
|
96
|
-
const value = valueSelector(element);
|
|
97
|
-
map.set(key, value);
|
|
98
|
-
}
|
|
99
|
-
return map;
|
|
100
|
-
};
|
|
101
|
-
URLSearchParams.prototype.getStrict = function (name) {
|
|
102
|
-
const item = this.get(name);
|
|
103
|
-
if (item === null) {
|
|
104
|
-
throw new Error(`key "${name}" not found in URL search parameters`);
|
|
105
|
-
}
|
|
106
|
-
return item;
|
|
107
|
-
};
|
|
108
|
-
URLSearchParams.prototype.getAsInteger = function (name, radix = 10) {
|
|
109
|
-
const item = this.get(name);
|
|
110
|
-
if (item === null)
|
|
111
|
-
return item;
|
|
112
|
-
return Number.parseInt(item, radix);
|
|
113
|
-
};
|
|
114
|
-
URLSearchParams.prototype.getAsIntegerStrict = function (name, radix = 10) {
|
|
115
|
-
const item = this.getStrict(name);
|
|
116
|
-
const parsed = Number.parseInt(item, radix);
|
|
117
|
-
if (!Number.isInteger(parsed)) {
|
|
118
|
-
throw new TypeError(`could not parse "${item}" as an integer`);
|
|
119
|
-
}
|
|
120
|
-
return parsed;
|
|
121
|
-
};
|
|
122
|
-
Array.fromElements = function (source, valueSelector) {
|
|
123
|
-
isValidElementSource(source);
|
|
124
|
-
const elements = parseElementSource(source);
|
|
125
|
-
return Array.from(elements, valueSelector);
|
|
126
|
-
};
|
|
127
|
-
Map.fromElements = function (source, keySelector, valueSelector) {
|
|
128
|
-
isValidElementSource(source);
|
|
129
|
-
const elements = parseElementSource(source);
|
|
130
|
-
const map = new Map();
|
|
131
|
-
for (const element of elements) {
|
|
132
|
-
if (!(element instanceof Element)) {
|
|
133
|
-
throw new TypeError('item in source array is not an element');
|
|
4
|
+
function getAttributeStrict() {
|
|
5
|
+
return function (attribute) {
|
|
6
|
+
const attr = this.getAttribute(attribute)?.trim();
|
|
7
|
+
if (typeof attr !== 'string' || attr.length === 0) {
|
|
8
|
+
throw new Error(`attribute "${attribute}" not found`);
|
|
134
9
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
return
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
10
|
+
return attr;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function getAttributeAsFloatStrict() {
|
|
14
|
+
return function (attribute) {
|
|
15
|
+
const attr = this.getAttributeStrict(attribute);
|
|
16
|
+
const value = Number.parseFloat(attr.trim());
|
|
17
|
+
if (!Number.isFinite(value)) {
|
|
18
|
+
throw new TypeError(`could not parse attribute "${attribute}" as float`);
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function getAttributeAsIntStrict() {
|
|
24
|
+
return function (attribute, radix = 10) {
|
|
25
|
+
const attr = this.getAttributeStrict(attribute);
|
|
26
|
+
const value = Number.parseInt(attr.trim(), radix);
|
|
27
|
+
if (!Number.isInteger(value)) {
|
|
28
|
+
throw new TypeError(`could not parse attribute "${attribute}" as integer`);
|
|
29
|
+
}
|
|
30
|
+
return value;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function getTextStrict() {
|
|
34
|
+
return function () {
|
|
35
|
+
const text = this.textContent?.trim();
|
|
36
|
+
if (typeof text !== 'string' || text.length === 0) {
|
|
37
|
+
throw new Error('element has no text content');
|
|
38
|
+
}
|
|
39
|
+
return text;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function getTextAsIntStrict() {
|
|
43
|
+
return function (radix = 10) {
|
|
44
|
+
const value = Number.parseInt(this.getTextStrict(), radix);
|
|
45
|
+
if (!Number.isInteger(value)) {
|
|
46
|
+
throw new TypeError('could not parse text content as integer');
|
|
47
|
+
}
|
|
48
|
+
return value;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function getTextAsFloatStrict() {
|
|
52
|
+
return function () {
|
|
53
|
+
const value = Number.parseFloat(this.getTextStrict());
|
|
54
|
+
if (!Number.isFinite(value)) {
|
|
55
|
+
throw new TypeError('could not parse text content as float');
|
|
56
|
+
}
|
|
57
|
+
return value;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function queryStrict() {
|
|
61
|
+
return function (selector) {
|
|
62
|
+
const element = this.querySelector(selector);
|
|
63
|
+
if (!element)
|
|
64
|
+
throw new Error(`no element found for selector "${selector}"`);
|
|
65
|
+
return element;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function queryAsArray() {
|
|
69
|
+
return function (selector, valueFn) {
|
|
70
|
+
valueFn ??= (element) => element;
|
|
71
|
+
const elements = this.querySelectorAll(selector);
|
|
72
|
+
return Array.from(elements, valueFn);
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function queryAsSet() {
|
|
76
|
+
return function (selector, valueFn) {
|
|
77
|
+
valueFn ??= (element) => element;
|
|
78
|
+
const elements = this.queryAsArray(selector, valueFn);
|
|
79
|
+
return new Set(elements);
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function queryAsMap() {
|
|
83
|
+
return function (selector, keyFn, valueFn) {
|
|
84
|
+
valueFn ??= (element) => element;
|
|
85
|
+
const elements = this.queryAsArray(selector);
|
|
86
|
+
const map = new Map();
|
|
87
|
+
for (const element of elements) {
|
|
88
|
+
const key = keyFn(element);
|
|
89
|
+
const value = valueFn(element);
|
|
90
|
+
map.set(key, value);
|
|
148
91
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
92
|
+
return map;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function waitChild() {
|
|
96
|
+
return function (selector, timeoutMillis = 300_000) {
|
|
97
|
+
const el = this.querySelector(selector);
|
|
98
|
+
if (el)
|
|
99
|
+
return Promise.resolve(el);
|
|
100
|
+
return new Promise((resolve, reject) => {
|
|
101
|
+
let timeout = null;
|
|
102
|
+
let interval = null;
|
|
103
|
+
const observer = new MutationObserver((mutations) => {
|
|
104
|
+
const element = this.querySelector(selector);
|
|
105
|
+
if (element) {
|
|
106
|
+
onElementFound(element);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
for (const mutation of mutations) {
|
|
110
|
+
if (mutation.type !== 'childList')
|
|
111
|
+
continue;
|
|
112
|
+
for (const node of Array.from(mutation.addedNodes)) {
|
|
113
|
+
if (node instanceof Element && node.matches(`:has(${selector})`)) {
|
|
114
|
+
onElementFound(node);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
function onElementFound(element) {
|
|
121
|
+
if (typeof timeout === 'number')
|
|
122
|
+
clearTimeout(timeout);
|
|
123
|
+
if (typeof interval === 'number')
|
|
124
|
+
clearInterval(interval);
|
|
125
|
+
observer.disconnect();
|
|
126
|
+
resolve(element);
|
|
127
|
+
}
|
|
128
|
+
function onInterval() {
|
|
129
|
+
const element = this.querySelector(selector);
|
|
130
|
+
if (element)
|
|
131
|
+
onElementFound(element);
|
|
132
|
+
}
|
|
133
|
+
function onTimeout() {
|
|
134
|
+
if (typeof interval === 'number')
|
|
135
|
+
clearInterval(interval);
|
|
136
|
+
observer.disconnect();
|
|
137
|
+
reject(new Error(`timeout waiting for element: ${selector}`));
|
|
138
|
+
}
|
|
139
|
+
interval = setInterval(onInterval.bind(this), 100);
|
|
140
|
+
timeout = setTimeout(onTimeout, timeoutMillis);
|
|
141
|
+
observer.observe(this, { childList: true, subtree: true });
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
const element = {
|
|
146
|
+
getAttributeStrict,
|
|
147
|
+
getAttributeAsFloatStrict,
|
|
148
|
+
getAttributeAsIntStrict,
|
|
149
|
+
getTextStrict,
|
|
150
|
+
getTextAsIntStrict,
|
|
151
|
+
getTextAsFloatStrict,
|
|
152
|
+
queryStrict,
|
|
153
|
+
queryAsArray,
|
|
154
|
+
queryAsSet,
|
|
155
|
+
queryAsMap,
|
|
156
|
+
waitChild
|
|
153
157
|
};
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
|
|
159
|
+
function getStrict() {
|
|
160
|
+
return function (name) {
|
|
161
|
+
const item = this.get(name);
|
|
162
|
+
if (typeof item !== 'string') {
|
|
163
|
+
throw new TypeError(`key "${name}" not found in URL search parameters`);
|
|
164
|
+
}
|
|
165
|
+
return item;
|
|
166
|
+
};
|
|
161
167
|
}
|
|
162
|
-
function
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
168
|
+
function getAsInteger() {
|
|
169
|
+
return function (name, radix = 10) {
|
|
170
|
+
const item = this.get(name);
|
|
171
|
+
if (typeof item !== 'string') {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
return Number.parseInt(item, radix);
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function getAsIntegerStrict() {
|
|
178
|
+
return function (name, radix = 10) {
|
|
179
|
+
const value = Number.parseInt(this.getStrict(name), radix);
|
|
180
|
+
if (!Number.isInteger(value)) {
|
|
181
|
+
throw new TypeError(`could not parse "${name}" as an integer`);
|
|
182
|
+
}
|
|
183
|
+
return value;
|
|
184
|
+
};
|
|
173
185
|
}
|
|
186
|
+
const urlSearchParams = {
|
|
187
|
+
getStrict,
|
|
188
|
+
getAsInteger,
|
|
189
|
+
getAsIntegerStrict
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
Document.prototype.queryStrict = element.queryStrict();
|
|
193
|
+
Document.prototype.queryAsArray = element.queryAsArray();
|
|
194
|
+
Document.prototype.queryAsSet = element.queryAsSet();
|
|
195
|
+
Document.prototype.queryAsMap = element.queryAsMap();
|
|
196
|
+
Document.prototype.waitChild = element.waitChild();
|
|
197
|
+
Element.prototype.getAttributeStrict = element.getAttributeStrict();
|
|
198
|
+
Element.prototype.getAttributeAsFloatStrict = element.getAttributeAsFloatStrict();
|
|
199
|
+
Element.prototype.getAttributeAsIntStrict = element.getAttributeAsIntStrict();
|
|
200
|
+
Element.prototype.getTextStrict = element.getTextStrict();
|
|
201
|
+
Element.prototype.getTextAsIntStrict = element.getTextAsIntStrict();
|
|
202
|
+
Element.prototype.getTextAsFloatStrict = element.getTextAsFloatStrict();
|
|
203
|
+
Element.prototype.queryStrict = element.queryStrict();
|
|
204
|
+
Element.prototype.queryAsArray = element.queryAsArray();
|
|
205
|
+
Element.prototype.queryAsSet = element.queryAsSet();
|
|
206
|
+
Element.prototype.queryAsMap = element.queryAsMap();
|
|
207
|
+
Element.prototype.waitChild = element.waitChild();
|
|
208
|
+
URLSearchParams.prototype.getStrict = urlSearchParams.getStrict();
|
|
209
|
+
URLSearchParams.prototype.getAsInteger = urlSearchParams.getAsInteger();
|
|
210
|
+
URLSearchParams.prototype.getAsIntegerStrict = urlSearchParams.getAsIntegerStrict();
|
|
174
211
|
|
|
175
212
|
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tb-dev/prototype-dom",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"description": "Adds prototype methods to DOM objects",
|
|
5
5
|
"packageManager": "pnpm@8.15.4",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,8 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
27
|
-
"@tb-dev/eslint-config": "^2.
|
|
28
|
-
"@types/node": "^20.11.20",
|
|
27
|
+
"@tb-dev/eslint-config": "^2.1.1",
|
|
29
28
|
"@vitest/ui": "^1.3.1",
|
|
30
29
|
"eslint": "^8.57.0",
|
|
31
30
|
"husky": "^9.0.11",
|
|
@@ -33,7 +32,7 @@
|
|
|
33
32
|
"prettier": "^3.2.5",
|
|
34
33
|
"rollup": "^4.12.0",
|
|
35
34
|
"tslib": "^2.6.2",
|
|
36
|
-
"typedoc": "^0.25.
|
|
35
|
+
"typedoc": "^0.25.9",
|
|
37
36
|
"typedoc-plugin-mdn-links": "^3.1.17",
|
|
38
37
|
"typescript": "5.3.3",
|
|
39
38
|
"vitest": "^1.3.1"
|
|
@@ -44,7 +43,7 @@
|
|
|
44
43
|
"main": "./dist/index.js",
|
|
45
44
|
"types": "./dist/index.d.ts",
|
|
46
45
|
"scripts": {
|
|
47
|
-
"build": "rollup --config rollup.config.js",
|
|
46
|
+
"build": "rollup --config rollup.config.js && node scripts/delete-artifacts.mjs",
|
|
48
47
|
"docs": "typedoc --plugin typedoc-plugin-mdn-links",
|
|
49
48
|
"format": "prettier . --write",
|
|
50
49
|
"format-check": "prettier . --check",
|