@design-edito/tools 0.1.19 → 0.1.20
Sign up to get free protection for your applications and to get access to all the features.
- package/agnostic/async/index.js +3 -3
- package/agnostic/css/index.js +3 -3
- package/agnostic/html/index.js +3 -3
- package/agnostic/misc/index.js +8 -8
- package/agnostic/misc/web-crawler/index.d.ts +16 -0
- package/agnostic/misc/web-crawler/index.js +42 -0
- package/agnostic/objects/index.js +7 -7
- package/agnostic/optim/index.js +3 -3
- package/agnostic/strings/index.js +9 -9
- package/agnostic/time/index.d.ts +9 -0
- package/agnostic/time/index.js +35 -0
- package/node/files/index.js +3 -3
- package/package.json +2 -1
package/agnostic/async/index.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
import {
|
2
|
-
timeoutCall
|
3
|
-
} from "../../chunks/chunk-4VC5PT5T.js";
|
4
1
|
import {
|
5
2
|
Transitions
|
6
3
|
} from "../../chunks/chunk-4GDNHUCZ.js";
|
7
4
|
import {
|
8
5
|
wait
|
9
6
|
} from "../../chunks/chunk-DQNJQBC6.js";
|
7
|
+
import {
|
8
|
+
timeoutCall
|
9
|
+
} from "../../chunks/chunk-4VC5PT5T.js";
|
10
10
|
|
11
11
|
// src/agnostic/async/index.ts
|
12
12
|
var Async;
|
package/agnostic/css/index.js
CHANGED
package/agnostic/html/index.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
import {
|
2
2
|
getNodeAncestors
|
3
3
|
} from "../../chunks/chunk-SQZGZ3VT.js";
|
4
|
-
import {
|
5
|
-
Placeholders
|
6
|
-
} from "../../chunks/chunk-VYW4IADX.js";
|
7
4
|
import {
|
8
5
|
getPositionInsideParent
|
9
6
|
} from "../../chunks/chunk-VTPRO4NJ.js";
|
7
|
+
import {
|
8
|
+
Placeholders
|
9
|
+
} from "../../chunks/chunk-VYW4IADX.js";
|
10
10
|
import {
|
11
11
|
insertNode
|
12
12
|
} from "../../chunks/chunk-XA4HVHJ4.js";
|
package/agnostic/misc/index.js
CHANGED
@@ -1,30 +1,30 @@
|
|
1
1
|
import {
|
2
|
-
|
3
|
-
} from "../../chunks/chunk-
|
2
|
+
Logs
|
3
|
+
} from "../../chunks/chunk-HEJV6JIO.js";
|
4
4
|
import {
|
5
5
|
Assert
|
6
6
|
} from "../../chunks/chunk-W7YBGJ4H.js";
|
7
|
-
import {
|
8
|
-
Logs
|
9
|
-
} from "../../chunks/chunk-HEJV6JIO.js";
|
10
7
|
import {
|
11
8
|
Cast
|
12
9
|
} from "../../chunks/chunk-4QQBKBYH.js";
|
10
|
+
import {
|
11
|
+
getCurrentDownlink
|
12
|
+
} from "../../chunks/chunk-7AWTHZLY.js";
|
13
13
|
import {
|
14
14
|
Random
|
15
15
|
} from "../../chunks/chunk-WLL3FNVL.js";
|
16
16
|
import {
|
17
17
|
Crossenv
|
18
18
|
} from "../../chunks/chunk-GJOU3UAL.js";
|
19
|
+
import {
|
20
|
+
isConstructorFunction
|
21
|
+
} from "../../chunks/chunk-RCO57B6F.js";
|
19
22
|
import "../../chunks/chunk-QXAJXTXV.js";
|
20
23
|
import {
|
21
24
|
isNotNullish,
|
22
25
|
isNullish,
|
23
26
|
nullishValues
|
24
27
|
} from "../../chunks/chunk-HC6ZOHCS.js";
|
25
|
-
import {
|
26
|
-
isConstructorFunction
|
27
|
-
} from "../../chunks/chunk-RCO57B6F.js";
|
28
28
|
|
29
29
|
// src/agnostic/misc/index.ts
|
30
30
|
var Misc;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export declare namespace WebCrawler {
|
2
|
+
function create<T extends any>(options: {
|
3
|
+
limit: number;
|
4
|
+
delayMs?: number | (() => number);
|
5
|
+
fetcher: (url: string) => Promise<T>;
|
6
|
+
processor: (url: string, content: T, hooks: {
|
7
|
+
push: (...urls: string[]) => void;
|
8
|
+
flush: () => void;
|
9
|
+
}) => any;
|
10
|
+
logger?: (ops: number, url: string, waitlist: string[], processed: Set<string>) => void;
|
11
|
+
}): {
|
12
|
+
crawl: (startUrl: string) => Promise<void>;
|
13
|
+
push: (url: string) => number;
|
14
|
+
flush: () => void;
|
15
|
+
};
|
16
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import {
|
2
|
+
wait
|
3
|
+
} from "../../../chunks/chunk-DQNJQBC6.js";
|
4
|
+
|
5
|
+
// src/agnostic/misc/web-crawler/index.ts
|
6
|
+
var WebCrawler;
|
7
|
+
((WebCrawler2) => {
|
8
|
+
function create(options) {
|
9
|
+
let ops = 0;
|
10
|
+
const waitlist = [];
|
11
|
+
const push = (url) => waitlist.push(url);
|
12
|
+
const flush = () => {
|
13
|
+
waitlist.length = 0;
|
14
|
+
};
|
15
|
+
const processed = /* @__PURE__ */ new Set();
|
16
|
+
const crawl = async (startUrl) => {
|
17
|
+
push(startUrl);
|
18
|
+
while (waitlist.length > 0 && ops < options.limit) {
|
19
|
+
ops++;
|
20
|
+
const currentUrl = waitlist[0];
|
21
|
+
if (options.logger !== void 0) options.logger(ops, currentUrl, waitlist, processed);
|
22
|
+
if (!processed.has(currentUrl)) {
|
23
|
+
const content = await options.fetcher(currentUrl);
|
24
|
+
await options.processor(currentUrl, content, { push, flush });
|
25
|
+
}
|
26
|
+
waitlist.shift();
|
27
|
+
processed.add(currentUrl);
|
28
|
+
const delayMs = typeof options.delayMs === "function" ? options.delayMs() : typeof options.delayMs === "number" ? options.delayMs : 0;
|
29
|
+
if (delayMs !== 0) await wait(delayMs);
|
30
|
+
}
|
31
|
+
};
|
32
|
+
return {
|
33
|
+
crawl,
|
34
|
+
push,
|
35
|
+
flush
|
36
|
+
};
|
37
|
+
}
|
38
|
+
WebCrawler2.create = create;
|
39
|
+
})(WebCrawler || (WebCrawler = {}));
|
40
|
+
export {
|
41
|
+
WebCrawler
|
42
|
+
};
|
@@ -1,20 +1,20 @@
|
|
1
|
+
import {
|
2
|
+
Enums
|
3
|
+
} from "../../chunks/chunk-WOAYU6LB.js";
|
4
|
+
import "../../chunks/chunk-E6MSDKON.js";
|
1
5
|
import {
|
2
6
|
flattenGetters
|
3
7
|
} from "../../chunks/chunk-PO3V3I57.js";
|
8
|
+
import {
|
9
|
+
isRecord
|
10
|
+
} from "../../chunks/chunk-YDIBNEGA.js";
|
4
11
|
import {
|
5
12
|
isNonNullObject,
|
6
13
|
isObject
|
7
14
|
} from "../../chunks/chunk-HQLRJ7XW.js";
|
8
|
-
import {
|
9
|
-
isRecord
|
10
|
-
} from "../../chunks/chunk-YDIBNEGA.js";
|
11
15
|
import {
|
12
16
|
Validation
|
13
17
|
} from "../../chunks/chunk-FPEW3A27.js";
|
14
|
-
import {
|
15
|
-
Enums
|
16
|
-
} from "../../chunks/chunk-WOAYU6LB.js";
|
17
|
-
import "../../chunks/chunk-E6MSDKON.js";
|
18
18
|
import "../../chunks/chunk-4QQBKBYH.js";
|
19
19
|
import "../../chunks/chunk-QXAJXTXV.js";
|
20
20
|
import "../../chunks/chunk-HC6ZOHCS.js";
|
package/agnostic/optim/index.js
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
import {
|
2
|
-
|
3
|
-
} from "../../chunks/chunk-
|
4
|
-
import {
|
5
|
-
matches,
|
6
|
-
matchesEvery,
|
7
|
-
matchesSome
|
8
|
-
} from "../../chunks/chunk-LQFKUNVQ.js";
|
2
|
+
toAlphanum
|
3
|
+
} from "../../chunks/chunk-COVPTTAD.js";
|
9
4
|
import {
|
10
5
|
replaceAll
|
11
6
|
} from "../../chunks/chunk-MF56TTC5.js";
|
7
|
+
import {
|
8
|
+
CharCodes
|
9
|
+
} from "../../chunks/chunk-34U4HX4V.js";
|
12
10
|
import {
|
13
11
|
normalizeIndent
|
14
12
|
} from "../../chunks/chunk-JQXNEJAP.js";
|
15
13
|
import {
|
16
|
-
|
17
|
-
|
14
|
+
matches,
|
15
|
+
matchesEvery,
|
16
|
+
matchesSome
|
17
|
+
} from "../../chunks/chunk-LQFKUNVQ.js";
|
18
18
|
|
19
19
|
// src/agnostic/strings/index.ts
|
20
20
|
var Strings;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export declare namespace Time {
|
2
|
+
function secondsToMs(seconds: number): number;
|
3
|
+
function minutesToMs(minutes: number): number;
|
4
|
+
function hoursToMs(hours: number): number;
|
5
|
+
function daysToMs(days: number): number;
|
6
|
+
function weeksToMs(weeks: number): number;
|
7
|
+
function monthsToMs(months: number): number;
|
8
|
+
function yearsToMs(years: number): number;
|
9
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
// src/agnostic/time/index.ts
|
2
|
+
var Time;
|
3
|
+
((Time2) => {
|
4
|
+
function secondsToMs(seconds) {
|
5
|
+
return seconds * 1e3;
|
6
|
+
}
|
7
|
+
Time2.secondsToMs = secondsToMs;
|
8
|
+
function minutesToMs(minutes) {
|
9
|
+
return secondsToMs(60 * minutes);
|
10
|
+
}
|
11
|
+
Time2.minutesToMs = minutesToMs;
|
12
|
+
function hoursToMs(hours) {
|
13
|
+
return minutesToMs(60 * hours);
|
14
|
+
}
|
15
|
+
Time2.hoursToMs = hoursToMs;
|
16
|
+
function daysToMs(days) {
|
17
|
+
return hoursToMs(24 * days);
|
18
|
+
}
|
19
|
+
Time2.daysToMs = daysToMs;
|
20
|
+
function weeksToMs(weeks) {
|
21
|
+
return daysToMs(7 * weeks);
|
22
|
+
}
|
23
|
+
Time2.weeksToMs = weeksToMs;
|
24
|
+
function monthsToMs(months) {
|
25
|
+
return daysToMs(30 * months);
|
26
|
+
}
|
27
|
+
Time2.monthsToMs = monthsToMs;
|
28
|
+
function yearsToMs(years) {
|
29
|
+
return daysToMs(365 * years);
|
30
|
+
}
|
31
|
+
Time2.yearsToMs = yearsToMs;
|
32
|
+
})(Time || (Time = {}));
|
33
|
+
export {
|
34
|
+
Time
|
35
|
+
};
|
package/node/files/index.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
import {
|
2
2
|
isInDirectory
|
3
3
|
} from "../../chunks/chunk-NRITRUZW.js";
|
4
|
-
import {
|
5
|
-
Subpaths
|
6
|
-
} from "../../chunks/chunk-HGCG2J77.js";
|
7
4
|
import {
|
8
5
|
readWrite
|
9
6
|
} from "../../chunks/chunk-7DBNMU6N.js";
|
7
|
+
import {
|
8
|
+
Subpaths
|
9
|
+
} from "../../chunks/chunk-HGCG2J77.js";
|
10
10
|
import "../../chunks/chunk-LQFKUNVQ.js";
|
11
11
|
|
12
12
|
// src/node/files/index.ts
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@design-edito/tools",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.20",
|
4
4
|
"description": "",
|
5
5
|
"author": "Maxime Fabas",
|
6
6
|
"license": "ISC",
|
@@ -27,6 +27,7 @@
|
|
27
27
|
"@types/semver": "^7.5.8",
|
28
28
|
"camelcase": "^8.0.0",
|
29
29
|
"esbuild": "^0.23.1",
|
30
|
+
"node-fetch": "^3.3.2",
|
30
31
|
"prompts": "^2.4.2",
|
31
32
|
"semver": "^7.6.3",
|
32
33
|
"simple-git": "^3.26.0",
|