Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@antora/redirect-producer

Package Overview
Dependencies
Maintainers
2
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antora/redirect-producer - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0-rc.1

24

lib/produce-redirects.js

@@ -36,5 +36,5 @@ 'use strict'

let siteUrl = playbook.site.url
if (siteUrl && siteUrl.charAt(siteUrl.length - 1) === '/') siteUrl = siteUrl.substr(0, siteUrl.length - 1)
switch (playbook.urls.redirectFacility) {
case 'static':
if (siteUrl && siteUrl.charAt(siteUrl.length - 1) === '/') siteUrl = siteUrl.substr(0, siteUrl.length - 1)
return populateStaticRedirectFiles(aliases, siteUrl)

@@ -44,7 +44,7 @@ case 'netlify':

aliases,
extractUrlContext(siteUrl),
extractUrlPath(siteUrl),
(playbook.urls.htmlExtensionStyle || 'default') === 'default'
)
case 'nginx':
return createNginxRewriteConf(aliases, extractUrlContext(siteUrl))
return createNginxRewriteConf(aliases, extractUrlPath(siteUrl))
default:

@@ -55,5 +55,5 @@ return unpublish(aliases)

function extractUrlContext (sourceUrl) {
let urlContext
return sourceUrl && (urlContext = new URL(sourceUrl).pathname) !== '/' ? urlContext : undefined
function extractUrlPath (url) {
let urlPath
return url && (urlPath = new URL(url).pathname) === '/' ? '' : urlPath
}

@@ -69,7 +69,7 @@

function createNetlifyRedirects (files, urlContext = '', includeDirectoryRedirects = false) {
function createNetlifyRedirects (files, urlPath = '', includeDirectoryRedirects = false) {
const rules = files.reduce((accum, file) => {
delete file.out
const from = `${urlContext}${file.pub.url.replace(ALL_SPACES_RX, '%20')}`
const to = `${urlContext}${file.rel.pub.url.replace(ALL_SPACES_RX, '%20')}`
const from = `${urlPath}${file.pub.url.replace(ALL_SPACES_RX, '%20')}`
const to = `${urlPath}${file.rel.pub.url.replace(ALL_SPACES_RX, '%20')}`
accum.push(`${from} ${to} 301`)

@@ -86,7 +86,7 @@ if (includeDirectoryRedirects && from.endsWith('/index.html')) accum.push(`${from.slice(0, -10)} ${to} 301`)

function createNginxRewriteConf (files, urlContext = '') {
function createNginxRewriteConf (files, urlPath = '') {
const rules = files.map((file) => {
delete file.out
const from = `${urlContext}${file.pub.url.replace(ALL_SPACES_RX, '\\ ')}`
const to = `${urlContext}${file.rel.pub.url.replace(ALL_SPACES_RX, '\\ ')}`
const from = `${urlPath}${file.pub.url.replace(ALL_SPACES_RX, '\\ ')}`
const to = `${urlPath}${file.rel.pub.url.replace(ALL_SPACES_RX, '\\ ')}`
return `location = ${from} { return 301 ${to}; }`

@@ -93,0 +93,0 @@ })

{
"name": "@antora/redirect-producer",
"version": "2.0.1",
"version": "2.1.0-rc.1",
"description": "Produces redirects (HTTP redirections) for pages in an Antora site.",

@@ -18,3 +18,3 @@ "license": "MPL-2.0",

"dependencies": {
"@antora/asciidoc-loader": "2.0.1",
"@antora/asciidoc-loader": "2.1.0-rc.1",
"vinyl": "~2.2"

@@ -21,0 +21,0 @@ },

@@ -15,4 +15,4 @@ # Antora Redirect Producer

Copyright (C) 2017-2018 [OpenDevise Inc.](https://opendevise.com) and the [Antora Project](https://antora.org).
Copyright (C) 2017-2019 [OpenDevise Inc.](https://opendevise.com) and the [Antora Project](https://antora.org).
Use of this software is granted under the terms of the [Mozilla Public License Version 2.0](https://www.mozilla.org/en-US/MPL/2.0/) (MPL-2.0).
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