mirror of
https://github.com/actions/configure-pages.git
synced 2025-12-08 08:06:09 +00:00
Update config parser to support export default with identifier and add SvelteKit code
Co-authored-by: NatoBoram <natoboram@users.noreply.github.com>
This commit is contained in:
18
dist/index.js
vendored
18
dist/index.js
vendored
@@ -14578,8 +14578,8 @@ class ConfigParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Find the configuration object in an AST.
|
// Find the configuration object in an AST.
|
||||||
// Look for a default export, a direct module export or an indirect module
|
// Look for a default export, an export default with idenfitier, a direct module export
|
||||||
// export (in that order).
|
// or an indirect module export (in that order).
|
||||||
//
|
//
|
||||||
// Return the configuration object or null.
|
// Return the configuration object or null.
|
||||||
findConfigurationObject(ast) {
|
findConfigurationObject(ast) {
|
||||||
@@ -14908,6 +14908,20 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, pat
|
|||||||
pathPrefix: path
|
pathPrefix: path
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case 'sveltekit':
|
||||||
|
// SvelteKit does not want a trailing slash
|
||||||
|
if (path.endsWith('/')) {
|
||||||
|
path = path.slice(0, -1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
configurationFile: './svelte.config.js',
|
||||||
|
blankConfigurationFile: __nccwpck_require__.ab + "sveltekit.js",
|
||||||
|
properties: {
|
||||||
|
// Configure a base path
|
||||||
|
'kit.paths.base': path
|
||||||
|
}
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
throw `Unsupported static site generator: ${staticSiteGenerator}`
|
throw `Unsupported static site generator: ${staticSiteGenerator}`
|
||||||
}
|
}
|
||||||
|
|||||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
8
dist/sveltekit.js
vendored
Normal file
8
dist/sveltekit.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// Default Pages configuration for SvelteKit
|
||||||
|
import adapter from '@sveltejs/adapter-auto'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
kit: {
|
||||||
|
adapter: adapter()
|
||||||
|
}
|
||||||
|
}
|
||||||
8
src/blank-configurations/sveltekit.js
Normal file
8
src/blank-configurations/sveltekit.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// Default Pages configuration for SvelteKit
|
||||||
|
import adapter from '@sveltejs/adapter-auto'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
kit: {
|
||||||
|
adapter: adapter()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -50,8 +50,8 @@ class ConfigParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Find the configuration object in an AST.
|
// Find the configuration object in an AST.
|
||||||
// Look for a default export, a direct module export or an indirect module
|
// Look for a default export, an export default with idenfitier, a direct module export
|
||||||
// export (in that order).
|
// or an indirect module export (in that order).
|
||||||
//
|
//
|
||||||
// Return the configuration object or null.
|
// Return the configuration object or null.
|
||||||
findConfigurationObject(ast) {
|
findConfigurationObject(ast) {
|
||||||
|
|||||||
9
src/fixtures/sveltekit/blank.expected.js
Normal file
9
src/fixtures/sveltekit/blank.expected.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
// Default Pages configuration for SvelteKit
|
||||||
|
import adapter from '@sveltejs/adapter-auto'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
kit: {
|
||||||
|
paths: { base: '/docs' },
|
||||||
|
adapter: adapter()
|
||||||
|
}
|
||||||
|
}
|
||||||
1
src/fixtures/sveltekit/blank.js
Normal file
1
src/fixtures/sveltekit/blank.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
// This file is not read by the test suite
|
||||||
11
src/fixtures/sveltekit/default.expected.js
Normal file
11
src/fixtures/sveltekit/default.expected.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import adapter from '@sveltejs/adapter-auto'
|
||||||
|
|
||||||
|
/** @type {import('@sveltejs/kit').Config} */
|
||||||
|
const config = {
|
||||||
|
kit: {
|
||||||
|
paths: { base: '/docs' },
|
||||||
|
adapter: adapter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default config
|
||||||
10
src/fixtures/sveltekit/default.js
Normal file
10
src/fixtures/sveltekit/default.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import adapter from '@sveltejs/adapter-auto'
|
||||||
|
|
||||||
|
/** @type {import('@sveltejs/kit').Config} */
|
||||||
|
const config = {
|
||||||
|
kit: {
|
||||||
|
adapter: adapter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default config
|
||||||
@@ -45,6 +45,20 @@ function getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, pat
|
|||||||
pathPrefix: path
|
pathPrefix: path
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case 'sveltekit':
|
||||||
|
// SvelteKit does not want a trailing slash
|
||||||
|
if (path.endsWith('/')) {
|
||||||
|
path = path.slice(0, -1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
configurationFile: './svelte.config.js',
|
||||||
|
blankConfigurationFile: `${__dirname}/blank-configurations/sveltekit.js`,
|
||||||
|
properties: {
|
||||||
|
// Configure a base path
|
||||||
|
'kit.paths.base': path
|
||||||
|
}
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
throw `Unsupported static site generator: ${staticSiteGenerator}`
|
throw `Unsupported static site generator: ${staticSiteGenerator}`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const { getTempFolder, compareFiles } = require('./test-helpers')
|
|||||||
// Get the temp folder
|
// Get the temp folder
|
||||||
const tempFolder = getTempFolder()
|
const tempFolder = getTempFolder()
|
||||||
|
|
||||||
const SUPPORTED_GENERATORS = ['next', 'nuxt', 'gatsby']
|
const SUPPORTED_GENERATORS = ['next', 'nuxt', 'gatsby', 'sveltekit']
|
||||||
const SUPPORTED_FILE_EXTENSIONS = ['.js', '.cjs', '.mjs']
|
const SUPPORTED_FILE_EXTENSIONS = ['.js', '.cjs', '.mjs']
|
||||||
|
|
||||||
// Test suite
|
// Test suite
|
||||||
|
|||||||
Reference in New Issue
Block a user