Skip to content

Commit

Permalink
4.5.7.2 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
cristian-rossi committed Feb 23, 2024
1 parent 70bdd9b commit a7586bb
Show file tree
Hide file tree
Showing 19 changed files with 16,109 additions and 16,300 deletions.
45 changes: 20 additions & 25 deletions build/aioseo-rollup-plugin-gettext-vue/callExpressionWithLiteral.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const ts = require('typescript')
const validate1 = require('gettext-extractor/dist/utils/validate')
const content1 = require('gettext-extractor/dist/utils/content')
const common1 = require('gettext-extractor/dist/js/extractors/common')
const utils1 = require('gettext-extractor/dist/js/utils')
const comments1 = require('gettext-extractor/dist/js/extractors/comments')

module.exports = function (calleeName, options, globalOptions) {
import ts from 'typescript'
import validate1 from 'gettext-extractor/dist/utils/validate'
import content1 from 'gettext-extractor/dist/utils/content'
import common1 from 'gettext-extractor/dist/js/extractors/common'
import utils1 from 'gettext-extractor/dist/js/utils'
import comments1 from 'gettext-extractor/dist/js/extractors/comments'

export default function (calleeName, options, globalOptions) {
validate1.Validate.required.argument({ calleeName })

const calleeNames = [].concat(calleeName)
Expand Down Expand Up @@ -37,7 +37,7 @@ module.exports = function (calleeName, options, globalOptions) {
}
}

const loggedBadPath = false
// const loggedBadPath = false
return (node, sourceFile, addMessage) => {
if (node.kind !== ts.SyntaxKind.CallExpression) {
return
Expand All @@ -54,14 +54,24 @@ module.exports = function (calleeName, options, globalOptions) {
return
}

// Get all the paths from the globalOptions.textDomains.
const paths = []
for (let i = 0; i < globalOptions.textDomains.length; i++) {
paths.push(globalOptions.textDomains[i].path)
}

// Check if the file is in the path for the current textdomain.
if (!paths.some(path => sourceFile.fileName.match(path))) {
return
}

if (!message.textDomain) {
console.error('\n', 'Missing a textdomain: ', message)
return
}

// Use a for loop to loop through the text domains array.
let valid = false,
badPath = false,
domains = []

for (let i = 0; i < globalOptions.textDomains.length; i++) {
Expand All @@ -73,13 +83,6 @@ module.exports = function (calleeName, options, globalOptions) {
...textDomain.matches
]

// Check if the file is in the path for the current textdomain.
if (!sourceFile.fileName.match(textDomain.path)) {
badPath = textDomain
badPath.fileName = sourceFile.fileName
continue
}

if (
textDomain.matches.includes(message.textDomain) ||
message.textDomain === textDomain.domain
Expand All @@ -88,14 +91,6 @@ module.exports = function (calleeName, options, globalOptions) {
}
}

// Only log the bad path once.
// if (loggedBadPath?.fileName !== badPath?.fileName) {
// loggedBadPath = JSON.parse(JSON.stringify(badPath))
// console.error('\n\n', '\x1b[41m The following error means there is a file included in this build which SHOULD NOT BE HERE! (Usually a Pro file inside a Lite build). \x1b[0m')
// console.error('\x1b[41m Please check the following error messages carefully and make sure you are including files properly. \x1b[0m', '\n')
// console.error('\n', '\x1b[31m Invalid path for textdomain: \x1b[0m', `${sourceFile.fileName}\n`, `\x1b[31m Current path pattern: \x1b[0m${badPath.path}\n`, `\x1b[31m Current textdomain: \x1b[0m${badPath.domain}\n`)
// }

if (!valid) {
const lineInfo = sourceFile.getLineAndCharacterOfPosition(node.getStart())
console.error('\n', 'Invalid textdomain: ', message, `${sourceFile.fileName}:${lineInfo.line}:${lineInfo.character}`, `Expected: ${domains.join(' or ')}. Found: "${message.textDomain}"`)
Expand Down
2 changes: 1 addition & 1 deletion build/aioseo-rollup-plugin-gettext-vue/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const optionsArray = [ {
extractorOptions : extractorOptions._nx
} ]

module.exports = {
export default {
defaultLanguage : defaultLanguage,
localesExt : LOCALES_EXT,
localedirmap : LOCALEDIRMAP,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const validate1 = require('gettext-extractor/dist/utils/validate')
const parser1 = require('gettext-extractor/dist/parser')
const ts = require('typescript')
import ts from 'typescript'
import validate1 from 'gettext-extractor/dist/utils/validate'
import parser1 from 'gettext-extractor/dist/parser'

module.exports = function (jsParser) {
export default function (jsParser) {
jsParser.parseSourceFile = function (source, fileName, options = {}) {
validate1.Validate.required.string({ source })
validate1.Validate.optional.nonEmptyString({ fileName })
Expand Down
23 changes: 11 additions & 12 deletions build/aioseo-rollup-plugin-gettext-vue/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
const { createFilter } = require('rollup-pluginutils')
const { GettextExtractor } = require('gettext-extractor')
const pluralForm = require('plural-forms')
const { SourceMapGenerator } = require('source-map')
const fs = require('fs')
const callExpressionWithLiteral = require('./callExpressionWithLiteral.js')
const decorateJsParserWithReplacer = require('./decorateJsParserWithReplacer.js')
const config = require('./config.js')
import { createFilter } from '@rollup/pluginutils'
import { GettextExtractor } from 'gettext-extractor'
import pluralForm from 'plural-forms'
import { SourceMapGenerator } from 'source-map'
import fs from 'fs'

import callExpressionWithLiteral from './callExpressionWithLiteral'
import decorateJsParserWithReplacer from './decorateJsParserWithReplacer'
import config from './config'

const cacheFilesParse = {}

function i18n (options = {}) {
export default function i18n (options = {}) {
const filter = createFilter(options.include, options.exclude)
const languageFiles = config.defaultLanguage
const language = languageFiles
Expand Down Expand Up @@ -173,6 +174,4 @@ function i18n (options = {}) {
})
}
}
}

module.exports = i18n
}
6 changes: 2 additions & 4 deletions build/aioseo-rollup-plugin-json-to-php/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'fs'

function jsonToPhp (files = []) {
export default function jsonToPhp (files = []) {
const log = msg => console.log('\x1b[36m%s\x1b[0m', msg)

return {
Expand Down Expand Up @@ -34,6 +34,4 @@ function jsonToPhp (files = []) {
})
}
}
}

module.exports = jsonToPhp
}
Loading

0 comments on commit a7586bb

Please sign in to comment.