single-file-cli 2.0.67 → 2.0.68
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/build.sh +1 -1
- package/deno.json +1 -1
- package/lib/single-file-bundle.js +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/single-file-cli-api.js +5 -5
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "2.0.
|
|
1
|
+
export const version = "2.0.68";
|
package/package.json
CHANGED
package/single-file-cli-api.js
CHANGED
|
@@ -162,7 +162,7 @@ async function runNextTask() {
|
|
|
162
162
|
task.filename = pageData.filename;
|
|
163
163
|
if (options.crawlLinks && testMaxDepth(task)) {
|
|
164
164
|
const urls = pageData.links;
|
|
165
|
-
let newTasks = await Promise.all(urls.map(url => createTask(url, options, task,
|
|
165
|
+
let newTasks = await Promise.all(urls.map(url => createTask(url, options, task, task.rootTaskURL || task.url)));
|
|
166
166
|
newTasks = newTasks.filter(task => task &&
|
|
167
167
|
testMaxDepth(task) &&
|
|
168
168
|
!tasks.find(otherTask => otherTask.url == task.url) &&
|
|
@@ -182,7 +182,7 @@ function testMaxDepth(task) {
|
|
|
182
182
|
(options.crawlExternalLinksMaxDepth == 0 || task.externalLinkDepth < options.crawlExternalLinksMaxDepth);
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
async function createTask(url, options, parentTask,
|
|
185
|
+
async function createTask(url, options, parentTask, rootTaskURL) {
|
|
186
186
|
url = parentTask ? rewriteURL(url, options.crawlRemoveURLFragment, options.crawlRewriteRules) : url;
|
|
187
187
|
if (url) {
|
|
188
188
|
if (!VALID_URL_TEST.test(url)) {
|
|
@@ -195,15 +195,15 @@ async function createTask(url, options, parentTask, rootTask) {
|
|
|
195
195
|
throw new Error("Invalid URL or file path: " + url, { cause: error });
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
-
const isInnerLink =
|
|
199
|
-
const rootBaseURIMatch =
|
|
198
|
+
const isInnerLink = rootTaskURL && url.startsWith(getHostURL(rootTaskURL));
|
|
199
|
+
const rootBaseURIMatch = rootTaskURL && rootTaskURL.match(/(.*?)[^/]*$/);
|
|
200
200
|
const isChild = isInnerLink && rootBaseURIMatch && rootBaseURIMatch[1] && url.startsWith(rootBaseURIMatch[1]);
|
|
201
201
|
return {
|
|
202
202
|
url,
|
|
203
203
|
isInnerLink,
|
|
204
204
|
isChild,
|
|
205
205
|
originalUrl: url,
|
|
206
|
-
|
|
206
|
+
rootTaskURL,
|
|
207
207
|
depth: parentTask ? parentTask.depth + 1 : 0,
|
|
208
208
|
externalLinkDepth: isInnerLink ? -1 : parentTask ? parentTask.externalLinkDepth + 1 : -1,
|
|
209
209
|
options
|