Socket
Socket
Sign inDemoInstall

@ewizardjs/pages-api

Package Overview
Dependencies
Maintainers
7
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ewizardjs/pages-api - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

11

dist/typings/interfaces/index.d.ts

@@ -23,8 +23,9 @@ export interface RootPage {

export interface NormalizeOptions {
pagesJson: Pages;
page: Page;
callback?: (page: Page) => unknown;
parentPath?: string;
settings?: SettingRecordsFragment;
pagesJson: Pages;
page: Page;
callback?: (page: Page) => unknown;
parentPath?: string;
parentDirPath?: string;
settings?: SettingRecordsFragment;
}
export type NormalizePageOptions = Omit<NormalizeOptions, 'page'>;

@@ -11,2 +11,3 @@ "use strict";

}
function getPagePath(parentPath, page, isRoot) {

@@ -18,5 +19,11 @@ if (isRoot) {

}
function getPageTemplate(page, pagesPath = 'pages') {
return page.template ?? (0, upath_1.join)(pagesPath, page.id, 'index.vue');
function getPageTemplate({ template, id }, pagesPath = 'pages', parentDirPath) {
if (template) {
return template;
}
const basePath = parentDirPath ? (0, upath_1.dirname)(parentDirPath) : pagesPath;
return (0, upath_1.join)(basePath, id, 'index.vue');
}
function getFlatPage(page) {

@@ -32,8 +39,16 @@ const flatPage = [page];

function normalizePage(options) {
const { pagesJson, page, callback, parentPath = '', settings } = options;
const { pagesJson, page, callback, parentPath = '', settings, parentDirPath } = options;
const { slug, path, children } = page;
const isRoot = pagesJson.root?.id === page.id;
page.slug = page.slug ?? getPageSlug(page, isRoot);
page.path = page.path ?? getPagePath(parentPath, page, isRoot);
page.template = getPageTemplate(page, settings?.path?.pages);
page.children = page.children?.map(child => normalizePage({ pagesJson, page: child, callback, parentPath: page.path, settings }));
page.slug = slug ?? getPageSlug(page, isRoot);
page.path = path ?? getPagePath(parentPath, page, isRoot);
page.template = getPageTemplate(page, settings?.path?.pages, parentDirPath);
if (children) {
const childrenOptions = {
...options,
parentPath: page.path,
parentDirPath: page.template,
};
page.children = getNormalizedPages(childrenOptions, children);
}
return callback ? callback(page) : page;

@@ -69,2 +84,2 @@ }

}
//# sourceMappingURL=index.js.map
//# sourceMappingURL=index.js.map
{
"name": "@ewizardjs/pages-api",
"version": "1.0.0",
"version": "1.1.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc