Skip to content

Commit

Permalink
Update distributables
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesMGreene committed Mar 29, 2024
1 parent 215cd51 commit f304bd8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
48 changes: 28 additions & 20 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36719,13 +36719,25 @@ module.exports = function removeTrailingSlash(str) {
/***/ 6310:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {

const fs = __nccwpck_require__(7147)
const core = __nccwpck_require__(2186)
const { ConfigParser } = __nccwpck_require__(8395)
const removeTrailingSlash = __nccwpck_require__(9255)
const { convertErrorToAnnotationProperties } = __nccwpck_require__(1507)

const SUPPORTED_FILE_EXTENSIONS = ['.js', '.cjs', '.mjs']

function detectOrDefaultConfigFile(fileBaseName, defaultExt = '.js') {
for (const ext of SUPPORTED_FILE_EXTENSIONS) {
const potentialConfigFile = `./${fileBaseName}${ext}`
if (fs.existsSync(potentialConfigFile)) {
return potentialConfigFile
}
}
// If none of them exist yet, default to returning the filename with the defaultExt extension
return `./${fileBaseName}${defaultExt}`
}

// Return the settings to be passed to a {ConfigParser} for a given static site generator,
// optional configuration file path, and a Pages siteUrl value to inject
function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, siteUrl }) {
Expand All @@ -36734,7 +36746,7 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, sit
switch (staticSiteGenerator) {
case 'nuxt':
return {
configurationFile: generatorConfigFile || './nuxt.config.js',
configurationFile: generatorConfigFile || detectOrDefaultConfigFile('nuxt.config'),
blankConfigurationFile: __nccwpck_require__.ab + "nuxt.js",
properties: {
// Configure a base path on the router
Expand All @@ -36750,7 +36762,7 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, sit
path = removeTrailingSlash(path)

return {
configurationFile: generatorConfigFile || './next.config.js',
configurationFile: generatorConfigFile || detectOrDefaultConfigFile('next.config'),
blankConfigurationFile: __nccwpck_require__.ab + "next.js",
properties: {
// Static export
Expand All @@ -36768,7 +36780,7 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, sit
}
case 'gatsby':
return {
configurationFile: generatorConfigFile || './gatsby-config.js',
configurationFile: generatorConfigFile || detectOrDefaultConfigFile('gatsby-config'),
blankConfigurationFile: __nccwpck_require__.ab + "gatsby.js",
properties: {
// Configure a path prefix
Expand All @@ -36782,7 +36794,7 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, sit
path = removeTrailingSlash(path)

return {
configurationFile: generatorConfigFile || './svelte.config.js',
configurationFile: generatorConfigFile || detectOrDefaultConfigFile('svelte.config'),
blankConfigurationFile: __nccwpck_require__.ab + "sveltekit.js",
properties: {
// Configure a base path
Expand All @@ -36798,27 +36810,23 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, sit

// Inject Pages configuration in a given static site generator's configuration file
function setPagesConfig({ staticSiteGenerator, generatorConfigFile, siteUrl }) {
const isSupportedFileExtension = SUPPORTED_FILE_EXTENSIONS.some(ext => generatorConfigFile.endsWith(ext))
if (generatorConfigFile && !isSupportedFileExtension) {
const supportedExtensionList = SUPPORTED_FILE_EXTENSIONS.map(ext => JSON.stringify(ext)).join(', ')
core.warning(
`Unsupported extension in configuration file: ${generatorConfigFile}. Currently supported extensions: ${supportedExtensionList}. We will still attempt to inject the site metadata into the configuration file, but it may not work as expected.`
)
}

try {
// Parse the configuration file and try to inject the Pages configuration in it
const settings = getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, siteUrl })
new ConfigParser(settings).injectAll()
} catch (error) {
const isSupportedFileExtension = SUPPORTED_FILE_EXTENSIONS.some(ext => generatorConfigFile.endsWith(ext))

// Logging
if (!isSupportedFileExtension) {
core.warning(
`Unsupported configuration file extension. Currently supported extensions: ${SUPPORTED_FILE_EXTENSIONS.map(
ext => JSON.stringify(ext)
).join(', ')}. Error: ${error.message}`,
convertErrorToAnnotationProperties(error)
)
} else {
core.warning(
`We were unable to determine how to inject the site metadata into your config. Generated URLs may be incorrect. The base URL for this site should be ${siteUrl}. Please ensure your framework is configured to generate relative links appropriately. Error: ${error.message}`,
convertErrorToAnnotationProperties(error)
)
}
core.warning(
`We were unable to determine how to inject the site metadata into your config. Generated URLs may be incorrect. The base URL for this site should be ${siteUrl}. Please ensure your framework is configured to generate relative links appropriately. Error: ${error.message}`,
convertErrorToAnnotationProperties(error)
)
}
}

Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

0 comments on commit f304bd8

Please sign in to comment.