scrapfly-sdk 0.6.2 → 0.6.5
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/README.md +4 -2
- package/esm/client.d.ts +17 -14
- package/esm/client.d.ts.map +1 -1
- package/esm/client.js +63 -24
- package/esm/deps/jsr.io/@std/path/1.0.1/_common/from_file_url.d.ts +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.1/_common/from_file_url.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/path/1.0.1/from_file_url.d.ts +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.1/from_file_url.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/path/1.0.1/posix/from_file_url.d.ts +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.1/posix/from_file_url.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/path/1.0.1/posix/to_file_url.d.ts +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.1/posix/to_file_url.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/path/1.0.1/to_file_url.d.ts +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.1/to_file_url.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/path/1.0.1/windows/from_file_url.d.ts +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.1/windows/from_file_url.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/path/1.0.1/windows/to_file_url.d.ts +0 -1
- package/esm/deps/jsr.io/@std/path/1.0.1/windows/to_file_url.d.ts.map +1 -1
- package/esm/polyfill.d.ts +5 -0
- package/esm/polyfill.d.ts.map +1 -0
- package/esm/polyfill.js +20 -0
- package/esm/result.d.ts +0 -1
- package/esm/result.d.ts.map +1 -1
- package/esm/result.js +9 -5
- package/esm/utils.d.ts +9 -2
- package/esm/utils.d.ts.map +1 -1
- package/esm/utils.js +20 -2
- package/package.json +1 -1
- package/script/client.d.ts +17 -14
- package/script/client.d.ts.map +1 -1
- package/script/client.js +63 -24
- package/script/deps/jsr.io/@std/path/1.0.1/_common/assert_path.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/_common/basename.js +3 -4
- package/script/deps/jsr.io/@std/path/1.0.1/_common/common.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/_common/dirname.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/_common/format.js +2 -3
- package/script/deps/jsr.io/@std/path/1.0.1/_common/from_file_url.d.ts +0 -1
- package/script/deps/jsr.io/@std/path/1.0.1/_common/from_file_url.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/1.0.1/_common/from_file_url.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/_common/glob_to_reg_exp.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/_common/normalize.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/_common/normalize_string.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/_common/relative.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/_common/strip_trailing_separators.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/_common/to_file_url.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/basename.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/common.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/dirname.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/extname.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/format.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/from_file_url.d.ts +0 -1
- package/script/deps/jsr.io/@std/path/1.0.1/from_file_url.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/1.0.1/from_file_url.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/glob_to_regexp.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/is_absolute.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/is_glob.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/join.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/join_globs.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/normalize.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/normalize_glob.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/parse.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/posix/_util.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/posix/basename.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/posix/dirname.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/posix/extname.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/posix/format.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/posix/from_file_url.d.ts +0 -1
- package/script/deps/jsr.io/@std/path/1.0.1/posix/from_file_url.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/1.0.1/posix/from_file_url.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/posix/glob_to_regexp.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/posix/is_absolute.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/posix/join.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/posix/join_globs.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/posix/normalize.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/posix/normalize_glob.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/posix/parse.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/posix/relative.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/posix/resolve.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/posix/to_file_url.d.ts +0 -1
- package/script/deps/jsr.io/@std/path/1.0.1/posix/to_file_url.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/1.0.1/posix/to_file_url.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/posix/to_namespaced_path.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/relative.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/resolve.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/to_file_url.d.ts +0 -1
- package/script/deps/jsr.io/@std/path/1.0.1/to_file_url.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/1.0.1/to_file_url.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/to_namespaced_path.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/windows/_util.js +3 -4
- package/script/deps/jsr.io/@std/path/1.0.1/windows/basename.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/windows/dirname.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/windows/extname.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/windows/format.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/windows/from_file_url.d.ts +0 -1
- package/script/deps/jsr.io/@std/path/1.0.1/windows/from_file_url.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/1.0.1/windows/from_file_url.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/windows/glob_to_regexp.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/windows/is_absolute.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/windows/join.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/windows/join_globs.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/windows/normalize.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/windows/normalize_glob.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/windows/parse.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/windows/relative.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/windows/resolve.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/windows/to_file_url.d.ts +0 -1
- package/script/deps/jsr.io/@std/path/1.0.1/windows/to_file_url.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/path/1.0.1/windows/to_file_url.js +1 -2
- package/script/deps/jsr.io/@std/path/1.0.1/windows/to_namespaced_path.js +1 -2
- package/script/polyfill.d.ts +5 -0
- package/script/polyfill.d.ts.map +1 -0
- package/script/polyfill.js +48 -0
- package/script/result.d.ts +0 -1
- package/script/result.d.ts.map +1 -1
- package/script/result.js +9 -5
- package/script/utils.d.ts +9 -2
- package/script/utils.d.ts.map +1 -1
- package/script/utils.js +23 -5
package/script/client.js
CHANGED
|
@@ -24,8 +24,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.ScrapflyClient = void 0;
|
|
27
|
-
const dntShim = __importStar(require("./_dnt.shims.js"));
|
|
28
27
|
const deps_js_1 = require("./deps.js");
|
|
28
|
+
const polyfill_js_1 = require("./polyfill.js");
|
|
29
29
|
const utils_js_1 = require("./utils.js");
|
|
30
30
|
const errors = __importStar(require("./errors.js"));
|
|
31
31
|
const result_js_1 = require("./result.js");
|
|
@@ -131,6 +131,39 @@ class ScrapflyClient {
|
|
|
131
131
|
}
|
|
132
132
|
return new errors.ScrapflyError(message, args);
|
|
133
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Handle clob and blob large objects
|
|
136
|
+
*/
|
|
137
|
+
async handleLargeObjects(result, format) {
|
|
138
|
+
let response;
|
|
139
|
+
try {
|
|
140
|
+
const url = new URL(result.content);
|
|
141
|
+
const params = { key: this.key };
|
|
142
|
+
url.search = new URLSearchParams(params).toString();
|
|
143
|
+
response = await this.fetch({
|
|
144
|
+
url: url.toString(),
|
|
145
|
+
method: 'GET',
|
|
146
|
+
headers: {
|
|
147
|
+
'user-agent': this.ua,
|
|
148
|
+
'accept-encoding': 'gzip, deflate, br',
|
|
149
|
+
accept: 'application/json',
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
catch (e) {
|
|
154
|
+
logger_js_1.log.error('error', e);
|
|
155
|
+
throw e;
|
|
156
|
+
}
|
|
157
|
+
const content = await response.text();
|
|
158
|
+
result.content = content;
|
|
159
|
+
if (format === 'clob') {
|
|
160
|
+
result.format = 'text';
|
|
161
|
+
}
|
|
162
|
+
if (format === 'blob') {
|
|
163
|
+
result.format = 'binary';
|
|
164
|
+
}
|
|
165
|
+
return result;
|
|
166
|
+
}
|
|
134
167
|
/**
|
|
135
168
|
* Turn scrapfly API response to ScrapeResult or raise one of ScrapflyError
|
|
136
169
|
*/
|
|
@@ -153,14 +186,15 @@ class ScrapflyClient {
|
|
|
153
186
|
const url = new URL(this.HOST + '/account');
|
|
154
187
|
const params = { key: this.key };
|
|
155
188
|
url.search = new URLSearchParams(params).toString();
|
|
156
|
-
response = await this.fetch(
|
|
189
|
+
response = await this.fetch({
|
|
190
|
+
url: url.toString(),
|
|
157
191
|
method: 'GET',
|
|
158
192
|
headers: {
|
|
159
193
|
'user-agent': this.ua,
|
|
160
194
|
'accept-encoding': 'gzip, deflate, br',
|
|
161
195
|
accept: 'application/json',
|
|
162
196
|
},
|
|
163
|
-
})
|
|
197
|
+
});
|
|
164
198
|
}
|
|
165
199
|
catch (e) {
|
|
166
200
|
logger_js_1.log.error('error', e);
|
|
@@ -185,7 +219,8 @@ class ScrapflyClient {
|
|
|
185
219
|
const url = new URL(this.HOST + '/scrape');
|
|
186
220
|
const params = config.toApiParams({ key: this.key });
|
|
187
221
|
url.search = new URLSearchParams(params).toString();
|
|
188
|
-
response = await this.fetch(
|
|
222
|
+
response = await this.fetch({
|
|
223
|
+
url: url.toString(),
|
|
189
224
|
method: config.method,
|
|
190
225
|
headers: {
|
|
191
226
|
'user-agent': this.ua,
|
|
@@ -196,7 +231,7 @@ class ScrapflyClient {
|
|
|
196
231
|
accept: 'application/json',
|
|
197
232
|
},
|
|
198
233
|
body: config.body,
|
|
199
|
-
})
|
|
234
|
+
});
|
|
200
235
|
}
|
|
201
236
|
catch (e) {
|
|
202
237
|
logger_js_1.log.error('error', e);
|
|
@@ -210,6 +245,10 @@ class ScrapflyClient {
|
|
|
210
245
|
}
|
|
211
246
|
throw new errors.ApiHttpClientError(JSON.stringify(data));
|
|
212
247
|
}
|
|
248
|
+
const content_format = data.result.format;
|
|
249
|
+
if (content_format === 'clob' || content_format === 'blob') {
|
|
250
|
+
data.result = await this.handleLargeObjects(data.result, content_format);
|
|
251
|
+
}
|
|
213
252
|
const result = this.handleResponse(response, new result_js_1.ScrapeResult({
|
|
214
253
|
config: data.config,
|
|
215
254
|
context: data.context,
|
|
@@ -219,21 +258,21 @@ class ScrapflyClient {
|
|
|
219
258
|
return result;
|
|
220
259
|
}
|
|
221
260
|
/**
|
|
222
|
-
|
|
223
|
-
|
|
261
|
+
Concurrently scrape multiple configs
|
|
262
|
+
This is a async generator call it like this:
|
|
224
263
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
264
|
+
const results = [];
|
|
265
|
+
const errors = [];
|
|
266
|
+
for await (const resultOrError of client.concurrentScrape(configs)) {
|
|
267
|
+
if (resultOrError instanceof Error) {
|
|
268
|
+
errors.push(resultOrError);
|
|
269
|
+
} else {
|
|
270
|
+
results.push(resultOrError);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
234
273
|
|
|
235
|
-
|
|
236
|
-
|
|
274
|
+
@param concurrencyLimit: if not set it will be taken from your account info
|
|
275
|
+
*/
|
|
237
276
|
async *concurrentScrape(configs, concurrencyLimit) {
|
|
238
277
|
if (concurrencyLimit === undefined) {
|
|
239
278
|
const account = await this.account();
|
|
@@ -276,7 +315,7 @@ class ScrapflyClient {
|
|
|
276
315
|
const extension_name = result.metadata.extension_name;
|
|
277
316
|
let file_path;
|
|
278
317
|
if (savePath) {
|
|
279
|
-
|
|
318
|
+
await (0, polyfill_js_1.mkdir)(savePath, { recursive: true });
|
|
280
319
|
file_path = deps_js_1.path.join(savePath, `${name}.${extension_name}`);
|
|
281
320
|
}
|
|
282
321
|
else {
|
|
@@ -284,7 +323,7 @@ class ScrapflyClient {
|
|
|
284
323
|
}
|
|
285
324
|
const content = new Uint8Array(result.image);
|
|
286
325
|
// Use Deno's write file method
|
|
287
|
-
await
|
|
326
|
+
await (0, polyfill_js_1.writeFile)(file_path, content);
|
|
288
327
|
}
|
|
289
328
|
/**
|
|
290
329
|
* Turn scrapfly screenshot API response to ScreenshotResult or raise one of ScrapflyError
|
|
@@ -315,7 +354,8 @@ class ScrapflyClient {
|
|
|
315
354
|
const url = new URL(this.HOST + '/screenshot');
|
|
316
355
|
const params = config.toApiParams({ key: this.key });
|
|
317
356
|
url.search = new URLSearchParams(params).toString();
|
|
318
|
-
|
|
357
|
+
response = await this.fetch({
|
|
358
|
+
url: url.toString(),
|
|
319
359
|
method: 'GET',
|
|
320
360
|
headers: {
|
|
321
361
|
'user-agent': this.ua,
|
|
@@ -323,7 +363,6 @@ class ScrapflyClient {
|
|
|
323
363
|
accept: 'application/json',
|
|
324
364
|
},
|
|
325
365
|
});
|
|
326
|
-
response = await this.fetch(req);
|
|
327
366
|
}
|
|
328
367
|
catch (e) {
|
|
329
368
|
logger_js_1.log.error('error', e);
|
|
@@ -371,12 +410,12 @@ class ScrapflyClient {
|
|
|
371
410
|
if (config.document_compression_format && config.document_compression_format) {
|
|
372
411
|
headers['content-encoding'] = config.document_compression_format;
|
|
373
412
|
}
|
|
374
|
-
|
|
413
|
+
response = await this.fetch({
|
|
414
|
+
url: url.toString(),
|
|
375
415
|
method: 'POST',
|
|
376
416
|
headers: headers,
|
|
377
417
|
body: config.body,
|
|
378
418
|
});
|
|
379
|
-
response = await this.fetch(req);
|
|
380
419
|
}
|
|
381
420
|
catch (e) {
|
|
382
421
|
logger_js_1.log.error('error', e);
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// Copyright the Browserify authors. MIT License.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.assertPath =
|
|
5
|
+
exports.assertPath = assertPath;
|
|
6
6
|
function assertPath(path) {
|
|
7
7
|
if (typeof path !== "string") {
|
|
8
8
|
throw new TypeError(`Path must be a string. Received ${JSON.stringify(path)}`);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
exports.assertPath = assertPath;
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports.stripSuffix = stripSuffix;
|
|
6
|
+
exports.lastPathSegment = lastPathSegment;
|
|
7
|
+
exports.assertArgs = assertArgs;
|
|
6
8
|
const assert_path_js_1 = require("./assert_path.js");
|
|
7
9
|
function stripSuffix(name, suffix) {
|
|
8
10
|
if (suffix.length >= name.length) {
|
|
@@ -16,7 +18,6 @@ function stripSuffix(name, suffix) {
|
|
|
16
18
|
}
|
|
17
19
|
return name.slice(0, -suffix.length);
|
|
18
20
|
}
|
|
19
|
-
exports.stripSuffix = stripSuffix;
|
|
20
21
|
function lastPathSegment(path, isSep, start = 0) {
|
|
21
22
|
let matchedNonSeparator = false;
|
|
22
23
|
let end = path.length;
|
|
@@ -34,7 +35,6 @@ function lastPathSegment(path, isSep, start = 0) {
|
|
|
34
35
|
}
|
|
35
36
|
return path.slice(start, end);
|
|
36
37
|
}
|
|
37
|
-
exports.lastPathSegment = lastPathSegment;
|
|
38
38
|
function assertArgs(path, suffix) {
|
|
39
39
|
(0, assert_path_js_1.assertPath)(path);
|
|
40
40
|
if (path.length === 0)
|
|
@@ -43,4 +43,3 @@ function assertArgs(path, suffix) {
|
|
|
43
43
|
throw new TypeError(`Suffix must be a string. Received ${JSON.stringify(suffix)}`);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
exports.assertArgs = assertArgs;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.common =
|
|
5
|
+
exports.common = common;
|
|
6
6
|
function common(paths, sep) {
|
|
7
7
|
const [first = "", ...remaining] = paths;
|
|
8
8
|
const parts = first.split(sep);
|
|
@@ -24,4 +24,3 @@ function common(paths, sep) {
|
|
|
24
24
|
}
|
|
25
25
|
return parts.slice(0, endOfPrefix).join(sep) + append;
|
|
26
26
|
}
|
|
27
|
-
exports.common = common;
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.assertArg =
|
|
5
|
+
exports.assertArg = assertArg;
|
|
6
6
|
const assert_path_js_1 = require("./assert_path.js");
|
|
7
7
|
function assertArg(path) {
|
|
8
8
|
(0, assert_path_js_1.assertPath)(path);
|
|
9
9
|
if (path.length === 0)
|
|
10
10
|
return ".";
|
|
11
11
|
}
|
|
12
|
-
exports.assertArg = assertArg;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports._format = _format;
|
|
6
|
+
exports.assertArg = assertArg;
|
|
6
7
|
function _format(sep, pathObject) {
|
|
7
8
|
const dir = pathObject.dir || pathObject.root;
|
|
8
9
|
const base = pathObject.base ||
|
|
@@ -15,10 +16,8 @@ function _format(sep, pathObject) {
|
|
|
15
16
|
return dir + base;
|
|
16
17
|
return dir + sep + base;
|
|
17
18
|
}
|
|
18
|
-
exports._format = _format;
|
|
19
19
|
function assertArg(pathObject) {
|
|
20
20
|
if (pathObject === null || typeof pathObject !== "object") {
|
|
21
21
|
throw new TypeError(`The "pathObject" argument must be of type Object. Received type ${typeof pathObject}`);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
exports.assertArg = assertArg;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"from_file_url.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.0.1/_common/from_file_url.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"from_file_url.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.0.1/_common/from_file_url.ts"],"names":[],"mappings":"AAGA,wBAAgB,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,OAM1C"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.assertArg =
|
|
5
|
+
exports.assertArg = assertArg;
|
|
6
6
|
function assertArg(url) {
|
|
7
7
|
url = url instanceof URL ? url : new URL(url);
|
|
8
8
|
if (url.protocol !== "file:") {
|
|
@@ -10,4 +10,3 @@ function assertArg(url) {
|
|
|
10
10
|
}
|
|
11
11
|
return url;
|
|
12
12
|
}
|
|
13
|
-
exports.assertArg = assertArg;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports._globToRegExp =
|
|
5
|
+
exports._globToRegExp = _globToRegExp;
|
|
6
6
|
const REG_EXP_ESCAPE_CHARS = [
|
|
7
7
|
"!",
|
|
8
8
|
"$",
|
|
@@ -235,4 +235,3 @@ caseInsensitive = false, } = {}) {
|
|
|
235
235
|
regExpString = `^${regExpString}$`;
|
|
236
236
|
return new RegExp(regExpString, caseInsensitive ? "i" : "");
|
|
237
237
|
}
|
|
238
|
-
exports._globToRegExp = _globToRegExp;
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.assertArg =
|
|
5
|
+
exports.assertArg = assertArg;
|
|
6
6
|
const assert_path_js_1 = require("./assert_path.js");
|
|
7
7
|
function assertArg(path) {
|
|
8
8
|
(0, assert_path_js_1.assertPath)(path);
|
|
9
9
|
if (path.length === 0)
|
|
10
10
|
return ".";
|
|
11
11
|
}
|
|
12
|
-
exports.assertArg = assertArg;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// Ported from https://github.com/browserify/path-browserify/
|
|
5
5
|
// This module is browser compatible.
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.normalizeString =
|
|
7
|
+
exports.normalizeString = normalizeString;
|
|
8
8
|
const constants_js_1 = require("./constants.js");
|
|
9
9
|
// Resolves . and .. elements in a path with directory names
|
|
10
10
|
function normalizeString(path, allowAboveRoot, separator, isPathSeparator) {
|
|
@@ -78,4 +78,3 @@ function normalizeString(path, allowAboveRoot, separator, isPathSeparator) {
|
|
|
78
78
|
}
|
|
79
79
|
return res;
|
|
80
80
|
}
|
|
81
|
-
exports.normalizeString = normalizeString;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.assertArgs =
|
|
5
|
+
exports.assertArgs = assertArgs;
|
|
6
6
|
const assert_path_js_1 = require("./assert_path.js");
|
|
7
7
|
function assertArgs(from, to) {
|
|
8
8
|
(0, assert_path_js_1.assertPath)(from);
|
|
@@ -10,4 +10,3 @@ function assertArgs(from, to) {
|
|
|
10
10
|
if (from === to)
|
|
11
11
|
return "";
|
|
12
12
|
}
|
|
13
|
-
exports.assertArgs = assertArgs;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// Ported from https://github.com/browserify/path-browserify/
|
|
5
5
|
// This module is browser compatible.
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.stripTrailingSeparators =
|
|
7
|
+
exports.stripTrailingSeparators = stripTrailingSeparators;
|
|
8
8
|
function stripTrailingSeparators(segment, isSep) {
|
|
9
9
|
if (segment.length <= 1) {
|
|
10
10
|
return segment;
|
|
@@ -20,4 +20,3 @@ function stripTrailingSeparators(segment, isSep) {
|
|
|
20
20
|
}
|
|
21
21
|
return segment.slice(0, end);
|
|
22
22
|
}
|
|
23
|
-
exports.stripTrailingSeparators = stripTrailingSeparators;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.encodeWhitespace =
|
|
5
|
+
exports.encodeWhitespace = encodeWhitespace;
|
|
6
6
|
const WHITESPACE_ENCODINGS = {
|
|
7
7
|
"\u0009": "%09",
|
|
8
8
|
"\u000A": "%0A",
|
|
@@ -16,4 +16,3 @@ function encodeWhitespace(string) {
|
|
|
16
16
|
return WHITESPACE_ENCODINGS[c] ?? c;
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
exports.encodeWhitespace = encodeWhitespace;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.basename =
|
|
5
|
+
exports.basename = basename;
|
|
6
6
|
const _os_js_1 = require("./_os.js");
|
|
7
7
|
const basename_js_1 = require("./posix/basename.js");
|
|
8
8
|
const basename_js_2 = require("./windows/basename.js");
|
|
@@ -34,4 +34,3 @@ function basename(path, suffix = "") {
|
|
|
34
34
|
? (0, basename_js_2.basename)(path, suffix)
|
|
35
35
|
: (0, basename_js_1.basename)(path, suffix);
|
|
36
36
|
}
|
|
37
|
-
exports.basename = basename;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.common =
|
|
5
|
+
exports.common = common;
|
|
6
6
|
const common_js_1 = require("./_common/common.js");
|
|
7
7
|
const constants_js_1 = require("./constants.js");
|
|
8
8
|
/**
|
|
@@ -34,4 +34,3 @@ const constants_js_1 = require("./constants.js");
|
|
|
34
34
|
function common(paths) {
|
|
35
35
|
return (0, common_js_1.common)(paths, constants_js_1.SEPARATOR);
|
|
36
36
|
}
|
|
37
|
-
exports.common = common;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.dirname =
|
|
5
|
+
exports.dirname = dirname;
|
|
6
6
|
const _os_js_1 = require("./_os.js");
|
|
7
7
|
const dirname_js_1 = require("./posix/dirname.js");
|
|
8
8
|
const dirname_js_2 = require("./windows/dirname.js");
|
|
@@ -27,4 +27,3 @@ const dirname_js_2 = require("./windows/dirname.js");
|
|
|
27
27
|
function dirname(path) {
|
|
28
28
|
return _os_js_1.isWindows ? (0, dirname_js_2.dirname)(path) : (0, dirname_js_1.dirname)(path);
|
|
29
29
|
}
|
|
30
|
-
exports.dirname = dirname;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.extname =
|
|
5
|
+
exports.extname = extname;
|
|
6
6
|
const _os_js_1 = require("./_os.js");
|
|
7
7
|
const extname_js_1 = require("./posix/extname.js");
|
|
8
8
|
const extname_js_2 = require("./windows/extname.js");
|
|
@@ -27,4 +27,3 @@ const extname_js_2 = require("./windows/extname.js");
|
|
|
27
27
|
function extname(path) {
|
|
28
28
|
return _os_js_1.isWindows ? (0, extname_js_2.extname)(path) : (0, extname_js_1.extname)(path);
|
|
29
29
|
}
|
|
30
|
-
exports.extname = extname;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.format =
|
|
5
|
+
exports.format = format;
|
|
6
6
|
const _os_js_1 = require("./_os.js");
|
|
7
7
|
const format_js_1 = require("./posix/format.js");
|
|
8
8
|
const format_js_2 = require("./windows/format.js");
|
|
@@ -28,4 +28,3 @@ const format_js_2 = require("./windows/format.js");
|
|
|
28
28
|
function format(pathObject) {
|
|
29
29
|
return _os_js_1.isWindows ? (0, format_js_2.format)(pathObject) : (0, format_js_1.format)(pathObject);
|
|
30
30
|
}
|
|
31
|
-
exports.format = format;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"from_file_url.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/path/1.0.1/from_file_url.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"from_file_url.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/path/1.0.1/from_file_url.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAErD"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.fromFileUrl =
|
|
5
|
+
exports.fromFileUrl = fromFileUrl;
|
|
6
6
|
const _os_js_1 = require("./_os.js");
|
|
7
7
|
const from_file_url_js_1 = require("./posix/from_file_url.js");
|
|
8
8
|
const from_file_url_js_2 = require("./windows/from_file_url.js");
|
|
@@ -29,4 +29,3 @@ const from_file_url_js_2 = require("./windows/from_file_url.js");
|
|
|
29
29
|
function fromFileUrl(url) {
|
|
30
30
|
return _os_js_1.isWindows ? (0, from_file_url_js_2.fromFileUrl)(url) : (0, from_file_url_js_1.fromFileUrl)(url);
|
|
31
31
|
}
|
|
32
|
-
exports.fromFileUrl = fromFileUrl;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.globToRegExp =
|
|
5
|
+
exports.globToRegExp = globToRegExp;
|
|
6
6
|
const _os_js_1 = require("./_os.js");
|
|
7
7
|
const glob_to_regexp_js_1 = require("./posix/glob_to_regexp.js");
|
|
8
8
|
const glob_to_regexp_js_2 = require("./windows/glob_to_regexp.js");
|
|
@@ -84,4 +84,3 @@ function globToRegExp(glob, options = {}) {
|
|
|
84
84
|
? (0, glob_to_regexp_js_2.globToRegExp)(glob, options)
|
|
85
85
|
: (0, glob_to_regexp_js_1.globToRegExp)(glob, options);
|
|
86
86
|
}
|
|
87
|
-
exports.globToRegExp = globToRegExp;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.isAbsolute =
|
|
5
|
+
exports.isAbsolute = isAbsolute;
|
|
6
6
|
const _os_js_1 = require("./_os.js");
|
|
7
7
|
const is_absolute_js_1 = require("./posix/is_absolute.js");
|
|
8
8
|
const is_absolute_js_2 = require("./windows/is_absolute.js");
|
|
@@ -29,4 +29,3 @@ const is_absolute_js_2 = require("./windows/is_absolute.js");
|
|
|
29
29
|
function isAbsolute(path) {
|
|
30
30
|
return _os_js_1.isWindows ? (0, is_absolute_js_2.isAbsolute)(path) : (0, is_absolute_js_1.isAbsolute)(path);
|
|
31
31
|
}
|
|
32
|
-
exports.isAbsolute = isAbsolute;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.isGlob =
|
|
5
|
+
exports.isGlob = isGlob;
|
|
6
6
|
/**
|
|
7
7
|
* Test whether the given string is a glob.
|
|
8
8
|
*
|
|
@@ -43,4 +43,3 @@ function isGlob(str) {
|
|
|
43
43
|
}
|
|
44
44
|
return false;
|
|
45
45
|
}
|
|
46
|
-
exports.isGlob = isGlob;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.join =
|
|
5
|
+
exports.join = join;
|
|
6
6
|
const _os_js_1 = require("./_os.js");
|
|
7
7
|
const join_js_1 = require("./posix/join.js");
|
|
8
8
|
const join_js_2 = require("./windows/join.js");
|
|
@@ -27,4 +27,3 @@ const join_js_2 = require("./windows/join.js");
|
|
|
27
27
|
function join(...paths) {
|
|
28
28
|
return _os_js_1.isWindows ? (0, join_js_2.join)(...paths) : (0, join_js_1.join)(...paths);
|
|
29
29
|
}
|
|
30
|
-
exports.join = join;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.joinGlobs =
|
|
5
|
+
exports.joinGlobs = joinGlobs;
|
|
6
6
|
const _os_js_1 = require("./_os.js");
|
|
7
7
|
const join_globs_js_1 = require("./posix/join_globs.js");
|
|
8
8
|
const join_globs_js_2 = require("./windows/join_globs.js");
|
|
@@ -35,4 +35,3 @@ function joinGlobs(globs, options = {}) {
|
|
|
35
35
|
? (0, join_globs_js_2.joinGlobs)(globs, options)
|
|
36
36
|
: (0, join_globs_js_1.joinGlobs)(globs, options);
|
|
37
37
|
}
|
|
38
|
-
exports.joinGlobs = joinGlobs;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.normalize =
|
|
5
|
+
exports.normalize = normalize;
|
|
6
6
|
const _os_js_1 = require("./_os.js");
|
|
7
7
|
const normalize_js_1 = require("./posix/normalize.js");
|
|
8
8
|
const normalize_js_2 = require("./windows/normalize.js");
|
|
@@ -31,4 +31,3 @@ const normalize_js_2 = require("./windows/normalize.js");
|
|
|
31
31
|
function normalize(path) {
|
|
32
32
|
return _os_js_1.isWindows ? (0, normalize_js_2.normalize)(path) : (0, normalize_js_1.normalize)(path);
|
|
33
33
|
}
|
|
34
|
-
exports.normalize = normalize;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.normalizeGlob =
|
|
5
|
+
exports.normalizeGlob = normalizeGlob;
|
|
6
6
|
const _os_js_1 = require("./_os.js");
|
|
7
7
|
const normalize_glob_js_1 = require("./posix/normalize_glob.js");
|
|
8
8
|
const normalize_glob_js_2 = require("./windows/normalize_glob.js");
|
|
@@ -36,4 +36,3 @@ function normalizeGlob(glob, options = {}) {
|
|
|
36
36
|
? (0, normalize_glob_js_2.normalizeGlob)(glob, options)
|
|
37
37
|
: (0, normalize_glob_js_1.normalizeGlob)(glob, options);
|
|
38
38
|
}
|
|
39
|
-
exports.normalizeGlob = normalizeGlob;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.parse =
|
|
5
|
+
exports.parse = parse;
|
|
6
6
|
const _os_js_1 = require("./_os.js");
|
|
7
7
|
const parse_js_1 = require("./posix/parse.js");
|
|
8
8
|
const parse_js_2 = require("./windows/parse.js");
|
|
@@ -40,4 +40,3 @@ const parse_js_2 = require("./windows/parse.js");
|
|
|
40
40
|
function parse(path) {
|
|
41
41
|
return _os_js_1.isWindows ? (0, parse_js_2.parse)(path) : (0, parse_js_1.parse)(path);
|
|
42
42
|
}
|
|
43
|
-
exports.parse = parse;
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
// Ported from https://github.com/browserify/path-browserify/
|
|
5
5
|
// This module is browser compatible.
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.isPosixPathSeparator =
|
|
7
|
+
exports.isPosixPathSeparator = isPosixPathSeparator;
|
|
8
8
|
const constants_js_1 = require("../_common/constants.js");
|
|
9
9
|
function isPosixPathSeparator(code) {
|
|
10
10
|
return code === constants_js_1.CHAR_FORWARD_SLASH;
|
|
11
11
|
}
|
|
12
|
-
exports.isPosixPathSeparator = isPosixPathSeparator;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.basename =
|
|
5
|
+
exports.basename = basename;
|
|
6
6
|
const basename_js_1 = require("../_common/basename.js");
|
|
7
7
|
const strip_trailing_separators_js_1 = require("../_common/strip_trailing_separators.js");
|
|
8
8
|
const _util_js_1 = require("./_util.js");
|
|
@@ -30,4 +30,3 @@ function basename(path, suffix = "") {
|
|
|
30
30
|
const strippedSegment = (0, strip_trailing_separators_js_1.stripTrailingSeparators)(lastSegment, _util_js_1.isPosixPathSeparator);
|
|
31
31
|
return suffix ? (0, basename_js_1.stripSuffix)(strippedSegment, suffix) : strippedSegment;
|
|
32
32
|
}
|
|
33
|
-
exports.basename = basename;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.dirname =
|
|
5
|
+
exports.dirname = dirname;
|
|
6
6
|
const dirname_js_1 = require("../_common/dirname.js");
|
|
7
7
|
const strip_trailing_separators_js_1 = require("../_common/strip_trailing_separators.js");
|
|
8
8
|
const _util_js_1 = require("./_util.js");
|
|
@@ -48,4 +48,3 @@ function dirname(path) {
|
|
|
48
48
|
}
|
|
49
49
|
return (0, strip_trailing_separators_js_1.stripTrailingSeparators)(path.slice(0, end), _util_js_1.isPosixPathSeparator);
|
|
50
50
|
}
|
|
51
|
-
exports.dirname = dirname;
|