scrapfly-sdk 0.6.4 → 0.6.6

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.
Files changed (117) hide show
  1. package/README.md +1 -1
  2. package/esm/client.d.ts +4 -1
  3. package/esm/client.d.ts.map +1 -1
  4. package/esm/client.js +39 -0
  5. package/esm/deps/jsr.io/@std/path/1.0.1/_common/from_file_url.d.ts +0 -1
  6. package/esm/deps/jsr.io/@std/path/1.0.1/_common/from_file_url.d.ts.map +1 -1
  7. package/esm/deps/jsr.io/@std/path/1.0.1/from_file_url.d.ts +0 -1
  8. package/esm/deps/jsr.io/@std/path/1.0.1/from_file_url.d.ts.map +1 -1
  9. package/esm/deps/jsr.io/@std/path/1.0.1/posix/from_file_url.d.ts +0 -1
  10. package/esm/deps/jsr.io/@std/path/1.0.1/posix/from_file_url.d.ts.map +1 -1
  11. package/esm/deps/jsr.io/@std/path/1.0.1/posix/to_file_url.d.ts +0 -1
  12. package/esm/deps/jsr.io/@std/path/1.0.1/posix/to_file_url.d.ts.map +1 -1
  13. package/esm/deps/jsr.io/@std/path/1.0.1/to_file_url.d.ts +0 -1
  14. package/esm/deps/jsr.io/@std/path/1.0.1/to_file_url.d.ts.map +1 -1
  15. package/esm/deps/jsr.io/@std/path/1.0.1/windows/from_file_url.d.ts +0 -1
  16. package/esm/deps/jsr.io/@std/path/1.0.1/windows/from_file_url.d.ts.map +1 -1
  17. package/esm/deps/jsr.io/@std/path/1.0.1/windows/to_file_url.d.ts +0 -1
  18. package/esm/deps/jsr.io/@std/path/1.0.1/windows/to_file_url.d.ts.map +1 -1
  19. package/esm/polyfill.d.ts +0 -1
  20. package/esm/polyfill.d.ts.map +1 -1
  21. package/esm/result.d.ts +0 -1
  22. package/esm/result.d.ts.map +1 -1
  23. package/esm/result.js +9 -5
  24. package/esm/utils.d.ts +2 -1
  25. package/esm/utils.d.ts.map +1 -1
  26. package/esm/utils.js +14 -0
  27. package/package.json +1 -1
  28. package/script/client.d.ts +4 -1
  29. package/script/client.d.ts.map +1 -1
  30. package/script/client.js +39 -0
  31. package/script/deps/jsr.io/@std/path/1.0.1/_common/assert_path.js +1 -2
  32. package/script/deps/jsr.io/@std/path/1.0.1/_common/basename.js +3 -4
  33. package/script/deps/jsr.io/@std/path/1.0.1/_common/common.js +1 -2
  34. package/script/deps/jsr.io/@std/path/1.0.1/_common/dirname.js +1 -2
  35. package/script/deps/jsr.io/@std/path/1.0.1/_common/format.js +2 -3
  36. package/script/deps/jsr.io/@std/path/1.0.1/_common/from_file_url.d.ts +0 -1
  37. package/script/deps/jsr.io/@std/path/1.0.1/_common/from_file_url.d.ts.map +1 -1
  38. package/script/deps/jsr.io/@std/path/1.0.1/_common/from_file_url.js +1 -2
  39. package/script/deps/jsr.io/@std/path/1.0.1/_common/glob_to_reg_exp.js +1 -2
  40. package/script/deps/jsr.io/@std/path/1.0.1/_common/normalize.js +1 -2
  41. package/script/deps/jsr.io/@std/path/1.0.1/_common/normalize_string.js +1 -2
  42. package/script/deps/jsr.io/@std/path/1.0.1/_common/relative.js +1 -2
  43. package/script/deps/jsr.io/@std/path/1.0.1/_common/strip_trailing_separators.js +1 -2
  44. package/script/deps/jsr.io/@std/path/1.0.1/_common/to_file_url.js +1 -2
  45. package/script/deps/jsr.io/@std/path/1.0.1/basename.js +1 -2
  46. package/script/deps/jsr.io/@std/path/1.0.1/common.js +1 -2
  47. package/script/deps/jsr.io/@std/path/1.0.1/dirname.js +1 -2
  48. package/script/deps/jsr.io/@std/path/1.0.1/extname.js +1 -2
  49. package/script/deps/jsr.io/@std/path/1.0.1/format.js +1 -2
  50. package/script/deps/jsr.io/@std/path/1.0.1/from_file_url.d.ts +0 -1
  51. package/script/deps/jsr.io/@std/path/1.0.1/from_file_url.d.ts.map +1 -1
  52. package/script/deps/jsr.io/@std/path/1.0.1/from_file_url.js +1 -2
  53. package/script/deps/jsr.io/@std/path/1.0.1/glob_to_regexp.js +1 -2
  54. package/script/deps/jsr.io/@std/path/1.0.1/is_absolute.js +1 -2
  55. package/script/deps/jsr.io/@std/path/1.0.1/is_glob.js +1 -2
  56. package/script/deps/jsr.io/@std/path/1.0.1/join.js +1 -2
  57. package/script/deps/jsr.io/@std/path/1.0.1/join_globs.js +1 -2
  58. package/script/deps/jsr.io/@std/path/1.0.1/normalize.js +1 -2
  59. package/script/deps/jsr.io/@std/path/1.0.1/normalize_glob.js +1 -2
  60. package/script/deps/jsr.io/@std/path/1.0.1/parse.js +1 -2
  61. package/script/deps/jsr.io/@std/path/1.0.1/posix/_util.js +1 -2
  62. package/script/deps/jsr.io/@std/path/1.0.1/posix/basename.js +1 -2
  63. package/script/deps/jsr.io/@std/path/1.0.1/posix/dirname.js +1 -2
  64. package/script/deps/jsr.io/@std/path/1.0.1/posix/extname.js +1 -2
  65. package/script/deps/jsr.io/@std/path/1.0.1/posix/format.js +1 -2
  66. package/script/deps/jsr.io/@std/path/1.0.1/posix/from_file_url.d.ts +0 -1
  67. package/script/deps/jsr.io/@std/path/1.0.1/posix/from_file_url.d.ts.map +1 -1
  68. package/script/deps/jsr.io/@std/path/1.0.1/posix/from_file_url.js +1 -2
  69. package/script/deps/jsr.io/@std/path/1.0.1/posix/glob_to_regexp.js +1 -2
  70. package/script/deps/jsr.io/@std/path/1.0.1/posix/is_absolute.js +1 -2
  71. package/script/deps/jsr.io/@std/path/1.0.1/posix/join.js +1 -2
  72. package/script/deps/jsr.io/@std/path/1.0.1/posix/join_globs.js +1 -2
  73. package/script/deps/jsr.io/@std/path/1.0.1/posix/normalize.js +1 -2
  74. package/script/deps/jsr.io/@std/path/1.0.1/posix/normalize_glob.js +1 -2
  75. package/script/deps/jsr.io/@std/path/1.0.1/posix/parse.js +1 -2
  76. package/script/deps/jsr.io/@std/path/1.0.1/posix/relative.js +1 -2
  77. package/script/deps/jsr.io/@std/path/1.0.1/posix/resolve.js +1 -2
  78. package/script/deps/jsr.io/@std/path/1.0.1/posix/to_file_url.d.ts +0 -1
  79. package/script/deps/jsr.io/@std/path/1.0.1/posix/to_file_url.d.ts.map +1 -1
  80. package/script/deps/jsr.io/@std/path/1.0.1/posix/to_file_url.js +1 -2
  81. package/script/deps/jsr.io/@std/path/1.0.1/posix/to_namespaced_path.js +1 -2
  82. package/script/deps/jsr.io/@std/path/1.0.1/relative.js +1 -2
  83. package/script/deps/jsr.io/@std/path/1.0.1/resolve.js +1 -2
  84. package/script/deps/jsr.io/@std/path/1.0.1/to_file_url.d.ts +0 -1
  85. package/script/deps/jsr.io/@std/path/1.0.1/to_file_url.d.ts.map +1 -1
  86. package/script/deps/jsr.io/@std/path/1.0.1/to_file_url.js +1 -2
  87. package/script/deps/jsr.io/@std/path/1.0.1/to_namespaced_path.js +1 -2
  88. package/script/deps/jsr.io/@std/path/1.0.1/windows/_util.js +3 -4
  89. package/script/deps/jsr.io/@std/path/1.0.1/windows/basename.js +1 -2
  90. package/script/deps/jsr.io/@std/path/1.0.1/windows/dirname.js +1 -2
  91. package/script/deps/jsr.io/@std/path/1.0.1/windows/extname.js +1 -2
  92. package/script/deps/jsr.io/@std/path/1.0.1/windows/format.js +1 -2
  93. package/script/deps/jsr.io/@std/path/1.0.1/windows/from_file_url.d.ts +0 -1
  94. package/script/deps/jsr.io/@std/path/1.0.1/windows/from_file_url.d.ts.map +1 -1
  95. package/script/deps/jsr.io/@std/path/1.0.1/windows/from_file_url.js +1 -2
  96. package/script/deps/jsr.io/@std/path/1.0.1/windows/glob_to_regexp.js +1 -2
  97. package/script/deps/jsr.io/@std/path/1.0.1/windows/is_absolute.js +1 -2
  98. package/script/deps/jsr.io/@std/path/1.0.1/windows/join.js +1 -2
  99. package/script/deps/jsr.io/@std/path/1.0.1/windows/join_globs.js +1 -2
  100. package/script/deps/jsr.io/@std/path/1.0.1/windows/normalize.js +1 -2
  101. package/script/deps/jsr.io/@std/path/1.0.1/windows/normalize_glob.js +1 -2
  102. package/script/deps/jsr.io/@std/path/1.0.1/windows/parse.js +1 -2
  103. package/script/deps/jsr.io/@std/path/1.0.1/windows/relative.js +1 -2
  104. package/script/deps/jsr.io/@std/path/1.0.1/windows/resolve.js +1 -2
  105. package/script/deps/jsr.io/@std/path/1.0.1/windows/to_file_url.d.ts +0 -1
  106. package/script/deps/jsr.io/@std/path/1.0.1/windows/to_file_url.d.ts.map +1 -1
  107. package/script/deps/jsr.io/@std/path/1.0.1/windows/to_file_url.js +1 -2
  108. package/script/deps/jsr.io/@std/path/1.0.1/windows/to_namespaced_path.js +1 -2
  109. package/script/polyfill.d.ts +0 -1
  110. package/script/polyfill.d.ts.map +1 -1
  111. package/script/polyfill.js +3 -3
  112. package/script/result.d.ts +0 -1
  113. package/script/result.d.ts.map +1 -1
  114. package/script/result.js +9 -5
  115. package/script/utils.d.ts +2 -1
  116. package/script/utils.d.ts.map +1 -1
  117. package/script/utils.js +17 -3
package/README.md CHANGED
@@ -99,7 +99,7 @@ $ deno lint
99
99
  # publish JSR:
100
100
  $ deno publish
101
101
  # build NPM package:
102
- $ deno build-npm
102
+ $ deno task build-npm
103
103
  # publish NPM:
104
104
  $ cd npm && npm publish
105
105
  ```
package/esm/client.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { fetchRetry } from './utils.js';
3
2
  import * as errors from './errors.js';
4
3
  import type { ScrapeConfig } from './scrapeconfig.js';
@@ -17,6 +16,10 @@ export declare class ScrapflyClient {
17
16
  * Raise appropriate error for given response and scrape result
18
17
  */
19
18
  errResult(response: Response, result: ScrapeResult): errors.ScrapflyError;
19
+ /**
20
+ * Handle clob and blob large objects
21
+ */
22
+ handleLargeObjects(result: any, format: 'clob' | 'blob'): Promise<ScrapeResult>;
20
23
  /**
21
24
  * Turn scrapfly API response to ScrapeResult or raise one of ScrapflyError
22
25
  */
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,MAAM,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AC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAkDzD;;;;;;;;;;;;;;;MAeE;IACK,gBAAgB,CACrB,OAAO,EAAE,YAAY,EAAE,EACvB,gBAAgB,CAAC,EAAE,MAAM,GACxB,cAAc,CAAC,YAAY,GAAG,KAAK,GAAG,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC;IAqCpE;;OAEG;IACG,cAAc,CAAC,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAqB7F;;OAEG;IACG,wBAAwB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAkB7E;;OAEG;IACG,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAuBrE;;OAEG;IACG,wBAAwB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAkB7E;;OAEG;IACG,OAAO,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CA6BnE"}
package/esm/client.js CHANGED
@@ -105,6 +105,41 @@ export class ScrapflyClient {
105
105
  }
106
106
  return new errors.ScrapflyError(message, args);
107
107
  }
108
+ /**
109
+ * Handle clob and blob large objects
110
+ */
111
+ async handleLargeObjects(result, format) {
112
+ let response;
113
+ try {
114
+ const url = new URL(result.content);
115
+ const params = { key: this.key };
116
+ url.search = new URLSearchParams(params).toString();
117
+ response = await this.fetch({
118
+ url: url.toString(),
119
+ method: 'GET',
120
+ headers: {
121
+ 'user-agent': this.ua,
122
+ 'accept-encoding': 'gzip, deflate, br',
123
+ accept: 'application/json',
124
+ },
125
+ });
126
+ }
127
+ catch (e) {
128
+ log.error('error', e);
129
+ throw e;
130
+ }
131
+ let content;
132
+ if (format === 'clob') {
133
+ content = await response.text();
134
+ result.format = 'text';
135
+ }
136
+ if (format === 'blob') {
137
+ content = new Uint8Array(await response.arrayBuffer());
138
+ result.format = 'binary';
139
+ }
140
+ result.content = content;
141
+ return result;
142
+ }
108
143
  /**
109
144
  * Turn scrapfly API response to ScrapeResult or raise one of ScrapflyError
110
145
  */
@@ -186,6 +221,10 @@ export class ScrapflyClient {
186
221
  }
187
222
  throw new errors.ApiHttpClientError(JSON.stringify(data));
188
223
  }
224
+ const content_format = data.result.format;
225
+ if (content_format === 'clob' || content_format === 'blob') {
226
+ data.result = await this.handleLargeObjects(data.result, content_format);
227
+ }
189
228
  const result = this.handleResponse(response, new ScrapeResult({
190
229
  config: data.config,
191
230
  context: data.context,
@@ -1,3 +1,2 @@
1
- /// <reference types="node" />
2
1
  export declare function assertArg(url: URL | string): URL;
3
2
  //# sourceMappingURL=from_file_url.d.ts.map
@@ -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":";AAGA,wBAAgB,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,OAM1C"}
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"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  /**
3
2
  * Converts a file URL to a path string.
4
3
  *
@@ -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":";AAOA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAErD"}
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"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  /**
3
2
  * Converts a file URL to a path string.
4
3
  *
@@ -1 +1 @@
1
- {"version":3,"file":"from_file_url.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.0.1/posix/from_file_url.ts"],"names":[],"mappings":";AAKA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,MAAM,CAKrD"}
1
+ {"version":3,"file":"from_file_url.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.0.1/posix/from_file_url.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,MAAM,CAKrD"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  /**
3
2
  * Converts a path string to a file URL.
4
3
  *
@@ -1 +1 @@
1
- {"version":3,"file":"to_file_url.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.0.1/posix/to_file_url.ts"],"names":[],"mappings":";AAMA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAU3C"}
1
+ {"version":3,"file":"to_file_url.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.0.1/posix/to_file_url.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAU3C"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  /**
3
2
  * Converts a path string to a file URL.
4
3
  *
@@ -1 +1 @@
1
- {"version":3,"file":"to_file_url.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/path/1.0.1/to_file_url.ts"],"names":[],"mappings":";AAOA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAE3C"}
1
+ {"version":3,"file":"to_file_url.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/path/1.0.1/to_file_url.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAE3C"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  /**
3
2
  * Converts a file URL to a path string.
4
3
  *
@@ -1 +1 @@
1
- {"version":3,"file":"from_file_url.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.0.1/windows/from_file_url.ts"],"names":[],"mappings":";AAKA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,MAAM,CAYrD"}
1
+ {"version":3,"file":"from_file_url.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.0.1/windows/from_file_url.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,MAAM,CAYrD"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  /**
3
2
  * Converts a path string to a file URL.
4
3
  *
@@ -1 +1 @@
1
- {"version":3,"file":"to_file_url.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.0.1/windows/to_file_url.ts"],"names":[],"mappings":";AAMA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAgB3C"}
1
+ {"version":3,"file":"to_file_url.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@std/path/1.0.1/windows/to_file_url.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAgB3C"}
package/esm/polyfill.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import * as dntShim from "./_dnt.shims.js";
3
2
  export declare const isDeno: boolean;
4
3
  export declare function mkdir(path: string | URL, options: dntShim.Deno.MkdirOptions): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"polyfill.d.ts","sourceRoot":"","sources":["../src/polyfill.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,eAAO,MAAM,MAAM,SAAsC,CAAC;AAE1D,wBAAsB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAOjG;AAED,wBAAsB,SAAS,CAC7B,IAAI,EAAE,MAAM,GAAG,GAAG,EAClB,IAAI,EAAE,UAAU,EAChB,OAAO,GAAE,OAAO,CAAC,IAAI,CAAC,gBAAqB,GAC1C,OAAO,CAAC,IAAI,CAAC,CAOf"}
1
+ {"version":3,"file":"polyfill.d.ts","sourceRoot":"","sources":["../src/polyfill.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,eAAO,MAAM,MAAM,SAAsC,CAAC;AAE1D,wBAAsB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAOjG;AAED,wBAAsB,SAAS,CAC7B,IAAI,EAAE,MAAM,GAAG,GAAG,EAClB,IAAI,EAAE,UAAU,EAChB,OAAO,GAAE,OAAO,CAAC,IAAI,CAAC,gBAAqB,GAC1C,OAAO,CAAC,IAAI,CAAC,CAOf"}
package/esm/result.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { HttpMethod, Rec } from './types.js';
3
2
  import { cheerio } from './deps.js';
4
3
  export type ConfigData = {
@@ -1 +1 @@
1
- {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,uBAAuB,EAAE,OAAO,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IAChB,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACrB,EAAE,CAAC,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MAAM,CAAC;gBACzB,oBAAoB,EAAE,MAAM,CAAC;gBAC7B,gBAAgB,EAAE,MAAM,CAAC;gBACzB,OAAO,EAAE,MAAM,CAAC;gBAChB,KAAK,EAAE,MAAM,CAAC;gBACd,KAAK,EAAE,MAAM,CAAC;gBACd,SAAS,EAAE,MAAM,CAAC;aACnB,CAAC;SACH,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,qBAAa,gBAAgB;IAC3B,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;gBAEV,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW;IAMjD,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,cAAc;CAOvB;AAED,qBAAa,gBAAgB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;gBAEV,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE;CAKpF"}
package/esm/result.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as errors from './errors.js';
2
2
  import { cheerio } from './deps.js';
3
+ import { normalizeHeaders } from './utils.js';
3
4
  export class ScrapeResult {
4
5
  constructor(data) {
5
6
  Object.defineProperty(this, "config", {
@@ -40,7 +41,8 @@ export class ScrapeResult {
40
41
  }
41
42
  get selector() {
42
43
  if (!this._selector) {
43
- if (!this.result.response_headers['content-type'].includes('text/html')) {
44
+ const headers = normalizeHeaders(this.result.response_headers);
45
+ if (!headers['content-type'].includes('text/html')) {
44
46
  throw new errors.ContentTypeError(`Cannot use selector on non-html content-type, received: ${this.result.response_headers['content-type']}`);
45
47
  }
46
48
  this._selector = cheerio.load(this.result.content);
@@ -73,19 +75,21 @@ export class ScreenshotResult {
73
75
  this.result = this.decodeResponse(response, data); // raw result
74
76
  }
75
77
  defineMetadata(response) {
76
- const contentType = response.headers.get('content-type');
78
+ const headers = normalizeHeaders(response.headers);
79
+ const contentType = headers['content-type'];
77
80
  let extension_name = '';
78
81
  if (contentType) {
79
82
  extension_name = contentType.split('/')[1].split(';')[0];
80
83
  }
81
84
  return {
82
85
  extension_name: extension_name,
83
- upstream_status_code: parseInt(response.headers.get('X-Scrapfly-Upstream-Http-Code') || '200', 10),
84
- upstream_url: response.headers.get('X-Scrapfly-Upstream-Url') || '',
86
+ upstream_status_code: parseInt(headers['x-scrapfly-upstream-http-code'] || '200', 10),
87
+ upstream_url: headers['x-scrapfly-upstream-url'] || '',
85
88
  };
86
89
  }
87
90
  decodeResponse(response, data) {
88
- if (response.headers.get('content-type') === 'json') {
91
+ const headers = normalizeHeaders(response.headers);
92
+ if (headers['content-type'] === 'json') {
89
93
  return JSON.parse(new TextDecoder().decode(data));
90
94
  }
91
95
  return null;
package/esm/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /// <reference types="node" />
1
+ import type { Rec } from './types.js';
2
2
  export declare function urlsafe_b64encode(data: string): string;
3
3
  export type RequestOptions = {
4
4
  url: string;
@@ -7,4 +7,5 @@ export type RequestOptions = {
7
7
  body?: string | Uint8Array;
8
8
  };
9
9
  export declare function fetchRetry(config: RequestOptions, retries?: number, retryDelay?: number): Promise<Response>;
10
+ export declare function normalizeHeaders(headers: Rec<string> | Headers): Rec<string>;
10
11
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAEA,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQtD;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;CAC5B,CAAC;AAEF,wBAAsB,UAAU,CAC9B,MAAM,EAAE,cAAc,EACtB,OAAO,GAAE,MAAU,EACnB,UAAU,GAAE,MAAa,GACxB,OAAO,CAAC,QAAQ,CAAC,CA+BnB"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQtD;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;CAC5B,CAAC;AAEF,wBAAsB,UAAU,CAC9B,MAAM,EAAE,cAAc,EACtB,OAAO,GAAE,MAAU,EACnB,UAAU,GAAE,MAAa,GACxB,OAAO,CAAC,QAAQ,CAAC,CA+BnB;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,CAc5E"}
package/esm/utils.js CHANGED
@@ -38,3 +38,17 @@ export async function fetchRetry(config, retries = 3, retryDelay = 1000) {
38
38
  }
39
39
  throw lastError;
40
40
  }
41
+ export function normalizeHeaders(headers) {
42
+ const normalizedHeaders = {};
43
+ if (headers instanceof Headers) {
44
+ headers.forEach((value, key) => {
45
+ normalizedHeaders[key.toLowerCase()] = value;
46
+ });
47
+ }
48
+ else {
49
+ Object.keys(headers).forEach((key) => {
50
+ normalizedHeaders[key.toLowerCase()] = headers[key];
51
+ });
52
+ }
53
+ return normalizedHeaders;
54
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scrapfly-sdk",
3
- "version": "0.6.4",
3
+ "version": "0.6.6",
4
4
  "description": "SDK for Scrapfly.io API for web scraping, screenshotting and data extraction",
5
5
  "keywords": [
6
6
  "web scraping",
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { fetchRetry } from './utils.js';
3
2
  import * as errors from './errors.js';
4
3
  import type { ScrapeConfig } from './scrapeconfig.js';
@@ -17,6 +16,10 @@ export declare class ScrapflyClient {
17
16
  * Raise appropriate error for given response and scrape result
18
17
  */
19
18
  errResult(response: Response, result: ScrapeResult): errors.ScrapflyError;
19
+ /**
20
+ * Handle clob and blob large objects
21
+ */
22
+ handleLargeObjects(result: any, format: 'clob' | 'blob'): Promise<ScrapeResult>;
20
23
  /**
21
24
  * Turn scrapfly API response to ScrapeResult or raise one of ScrapflyError
22
25
  */
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,KAAK,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIjG,qBAAa,cAAc;IAClB,IAAI,SAA6B;IACxC,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,EAAE,CAAS;IACnB,KAAK,oBAAc;gBAEP,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CA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B,CAAC;IAkB7E;;OAEG;IACG,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAuBrE;;OAEG;IACG,wBAAwB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAkB7E;;OAEG;IACG,OAAO,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CA6BnE"}
package/script/client.js CHANGED
@@ -131,6 +131,41 @@ 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
+ let content;
158
+ if (format === 'clob') {
159
+ content = await response.text();
160
+ result.format = 'text';
161
+ }
162
+ if (format === 'blob') {
163
+ content = new Uint8Array(await response.arrayBuffer());
164
+ result.format = 'binary';
165
+ }
166
+ result.content = content;
167
+ return result;
168
+ }
134
169
  /**
135
170
  * Turn scrapfly API response to ScrapeResult or raise one of ScrapflyError
136
171
  */
@@ -212,6 +247,10 @@ class ScrapflyClient {
212
247
  }
213
248
  throw new errors.ApiHttpClientError(JSON.stringify(data));
214
249
  }
250
+ const content_format = data.result.format;
251
+ if (content_format === 'clob' || content_format === 'blob') {
252
+ data.result = await this.handleLargeObjects(data.result, content_format);
253
+ }
215
254
  const result = this.handleResponse(response, new result_js_1.ScrapeResult({
216
255
  config: data.config,
217
256
  context: data.context,
@@ -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 = void 0;
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.assertArgs = exports.lastPathSegment = exports.stripSuffix = void 0;
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 = void 0;
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 = void 0;
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.assertArg = exports._format = void 0;
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,3 +1,2 @@
1
- /// <reference types="node" />
2
1
  export declare function assertArg(url: URL | string): URL;
3
2
  //# sourceMappingURL=from_file_url.d.ts.map
@@ -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":";AAGA,wBAAgB,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,OAM1C"}
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 = void 0;
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 = void 0;
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 = void 0;
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 = void 0;
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 = void 0;
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 = void 0;
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 = void 0;
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 = void 0;
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;