astro-accelerator-utils 0.0.6 → 0.0.7
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 +3 -1
- package/dist/index.js +3 -1
- package/dist/lib/postQueries.d.ts +3 -1
- package/dist/lib/postQueries.js +26 -18
- package/dist/types/PagePredicate.d.ts +2 -0
- package/dist/types/PagePredicate.js +2 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export type { Site } from './types/Site';
|
|
2
1
|
export type { Frontmatter } from './types/Frontmatter';
|
|
2
|
+
export type { PagePredicate } from './types/PagePredicate';
|
|
3
|
+
export type { Site } from './types/Site';
|
|
3
4
|
export { getCachePath, getItem, getItemPath, setItem } from './lib/Cache';
|
|
4
5
|
export { formatDate, formatModifiedDate } from './lib/dates';
|
|
5
6
|
export { isAuthor, isListable, isSearch, showInMenu, showInSearch, showInSitemap } from './lib/postFiltering';
|
|
6
7
|
export { sortByModDate, sortByPubDate, sortByPubDateDesc } from './lib/postOrdering';
|
|
8
|
+
export { getPages } from './lib/postQueries';
|
|
7
9
|
export { addSlashToAddress, addSlashToUrl } from './lib/urls';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addSlashToUrl = exports.addSlashToAddress = exports.sortByPubDateDesc = exports.sortByPubDate = exports.sortByModDate = exports.showInSitemap = exports.showInSearch = exports.showInMenu = exports.isSearch = exports.isListable = exports.isAuthor = exports.formatModifiedDate = exports.formatDate = exports.setItem = exports.getItemPath = exports.getItem = exports.getCachePath = void 0;
|
|
3
|
+
exports.addSlashToUrl = exports.addSlashToAddress = exports.getPages = exports.sortByPubDateDesc = exports.sortByPubDate = exports.sortByModDate = exports.showInSitemap = exports.showInSearch = exports.showInMenu = exports.isSearch = exports.isListable = exports.isAuthor = exports.formatModifiedDate = exports.formatDate = exports.setItem = exports.getItemPath = exports.getItem = exports.getCachePath = void 0;
|
|
4
4
|
var Cache_1 = require("./lib/Cache");
|
|
5
5
|
Object.defineProperty(exports, "getCachePath", { enumerable: true, get: function () { return Cache_1.getCachePath; } });
|
|
6
6
|
Object.defineProperty(exports, "getItem", { enumerable: true, get: function () { return Cache_1.getItem; } });
|
|
@@ -20,6 +20,8 @@ var postOrdering_1 = require("./lib/postOrdering");
|
|
|
20
20
|
Object.defineProperty(exports, "sortByModDate", { enumerable: true, get: function () { return postOrdering_1.sortByModDate; } });
|
|
21
21
|
Object.defineProperty(exports, "sortByPubDate", { enumerable: true, get: function () { return postOrdering_1.sortByPubDate; } });
|
|
22
22
|
Object.defineProperty(exports, "sortByPubDateDesc", { enumerable: true, get: function () { return postOrdering_1.sortByPubDateDesc; } });
|
|
23
|
+
var postQueries_1 = require("./lib/postQueries");
|
|
24
|
+
Object.defineProperty(exports, "getPages", { enumerable: true, get: function () { return postQueries_1.getPages; } });
|
|
23
25
|
var urls_1 = require("./lib/urls");
|
|
24
26
|
Object.defineProperty(exports, "addSlashToAddress", { enumerable: true, get: function () { return urls_1.addSlashToAddress; } });
|
|
25
27
|
Object.defineProperty(exports, "addSlashToUrl", { enumerable: true, get: function () { return urls_1.addSlashToUrl; } });
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { Markdown } from "../types/Markdown";
|
|
2
|
+
import { PagePredicate } from "../types/PagePredicate";
|
|
3
|
+
export declare function getPages(fetchPages: () => Record<string, any>, filter?: PagePredicate | null): Promise<Markdown<Record<string, any>>[]>;
|
package/dist/lib/postQueries.js
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
3
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
exports.getPages = void 0;
|
|
13
|
+
const Cache_1 = require("./Cache");
|
|
14
|
+
function getPages(fetchPages, filter) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const key = 'PageQueries__getPages';
|
|
17
|
+
let allPages = yield (0, Cache_1.getItem)(key);
|
|
18
|
+
if (allPages == null) {
|
|
19
|
+
const pageImportResult = fetchPages();
|
|
20
|
+
allPages = Object.values(pageImportResult);
|
|
21
|
+
yield (0, Cache_1.setItem)(key, allPages);
|
|
22
|
+
}
|
|
23
|
+
if (filter == null) {
|
|
24
|
+
return allPages;
|
|
25
|
+
}
|
|
26
|
+
return allPages.filter(filter);
|
|
27
|
+
});
|
|
20
28
|
}
|
|
21
|
-
exports.
|
|
29
|
+
exports.getPages = getPages;
|