diff --git a/.changeset/ten-bats-sneeze.md b/.changeset/ten-bats-sneeze.md new file mode 100644 index 000000000000..b813b4239a54 --- /dev/null +++ b/.changeset/ten-bats-sneeze.md @@ -0,0 +1,5 @@ +--- +'create-svelte': minor +--- + +feat: upgrade to prettier 3 and prettier-plugin-svelte 3 diff --git a/.prettierrc b/.prettierrc index 72264f51e616..ee82b5c88a09 100644 --- a/.prettierrc +++ b/.prettierrc @@ -3,6 +3,7 @@ "singleQuote": true, "trailingComma": "none", "printWidth": 100, + "plugins": ["prettier-plugin-svelte"], "overrides": [ { "files": ["*.svelte"], diff --git a/package.json b/package.json index bea268651f67..73b097d75e9d 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "postinstall": "pnpm -r generate:types" }, "devDependencies": { - "@changesets/cli": "^2.26.0", + "@changesets/cli": "^2.26.2", "@rollup/plugin-commonjs": "^25.0.0", "@rollup/plugin-json": "^6.0.0", "@rollup/plugin-node-resolve": "^15.0.1", @@ -32,7 +32,7 @@ "eslint-plugin-svelte": "^2.31.0", "eslint-plugin-unicorn": "^49.0.0", "playwright": "1.30.0", - "prettier": "^2.8.0", + "prettier": "^3.1.0", "rollup": "^3.29.4", "svelte": "^4.2.2", "typescript": "^4.9.4" diff --git a/packages/adapter-auto/package.json b/packages/adapter-auto/package.json index 193ea74b0f9c..037ba5fd38ab 100644 --- a/packages/adapter-auto/package.json +++ b/packages/adapter-auto/package.json @@ -25,7 +25,7 @@ "adapters.js" ], "scripts": { - "lint": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore", + "lint": "prettier --check .", "format": "pnpm lint --write", "check": "tsc" }, diff --git a/packages/adapter-cloudflare-workers/package.json b/packages/adapter-cloudflare-workers/package.json index faf029f014ca..5c17e85c9b00 100644 --- a/packages/adapter-cloudflare-workers/package.json +++ b/packages/adapter-cloudflare-workers/package.json @@ -25,7 +25,7 @@ "index.d.ts" ], "scripts": { - "lint": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore", + "lint": "prettier --check .", "format": "pnpm lint --write", "check": "tsc" }, diff --git a/packages/adapter-cloudflare/package.json b/packages/adapter-cloudflare/package.json index a686bfa841f3..d3e7e6a5e046 100644 --- a/packages/adapter-cloudflare/package.json +++ b/packages/adapter-cloudflare/package.json @@ -26,7 +26,7 @@ ], "scripts": { "build": "esbuild src/worker.js --bundle --outfile=files/worker.js --external:SERVER --external:MANIFEST --format=esm", - "lint": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore", + "lint": "prettier --check .", "format": "pnpm lint --write", "check": "tsc --skipLibCheck", "prepublishOnly": "pnpm build" diff --git a/packages/adapter-netlify/package.json b/packages/adapter-netlify/package.json index b15c395f5c01..b417461d9b8f 100644 --- a/packages/adapter-netlify/package.json +++ b/packages/adapter-netlify/package.json @@ -28,7 +28,7 @@ "build": "node -e \"fs.rmSync('files', { force: true, recursive: true })\" && rollup -c && cp src/edge.js files/edge.js", "test": "vitest run", "check": "tsc", - "lint": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore", + "lint": "prettier --check .", "format": "pnpm lint --write", "prepublishOnly": "pnpm build" }, diff --git a/packages/adapter-node/package.json b/packages/adapter-node/package.json index 3588e72581fa..d18a3f1c46f1 100644 --- a/packages/adapter-node/package.json +++ b/packages/adapter-node/package.json @@ -28,7 +28,7 @@ "build": "node -e \"fs.rmSync('files', { force: true, recursive: true })\" && rollup -c", "test": "echo \"tests temporarily disabled\" # c8 vitest run", "check": "tsc", - "lint": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore", + "lint": "prettier --check .", "format": "pnpm lint --write", "prepublishOnly": "pnpm build" }, diff --git a/packages/adapter-static/package.json b/packages/adapter-static/package.json index a6229898227e..05a10a8cdc3c 100644 --- a/packages/adapter-static/package.json +++ b/packages/adapter-static/package.json @@ -24,7 +24,7 @@ "platforms.js" ], "scripts": { - "lint": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore", + "lint": "prettier --check .", "check": "tsc", "format": "pnpm lint --write", "test": "pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test" diff --git a/packages/adapter-static/test/apps/prerendered/src/app.html b/packages/adapter-static/test/apps/prerendered/src/app.html index 568b69b887b8..d533c5e31716 100644 --- a/packages/adapter-static/test/apps/prerendered/src/app.html +++ b/packages/adapter-static/test/apps/prerendered/src/app.html @@ -1,4 +1,4 @@ - + diff --git a/packages/adapter-static/test/apps/spa/src/app.html b/packages/adapter-static/test/apps/spa/src/app.html index 568b69b887b8..d533c5e31716 100644 --- a/packages/adapter-static/test/apps/spa/src/app.html +++ b/packages/adapter-static/test/apps/spa/src/app.html @@ -1,4 +1,4 @@ - + diff --git a/packages/adapter-static/test/apps/spa/src/routes/+layout.svelte b/packages/adapter-static/test/apps/spa/src/routes/+layout.svelte index d89ceb3fed43..439e52c54c97 100644 --- a/packages/adapter-static/test/apps/spa/src/routes/+layout.svelte +++ b/packages/adapter-static/test/apps/spa/src/routes/+layout.svelte @@ -3,4 +3,4 @@ about - \ No newline at end of file + diff --git a/packages/adapter-static/test/apps/spa/src/routes/+page.svelte b/packages/adapter-static/test/apps/spa/src/routes/+page.svelte index 913f0784cbb6..aaa08e08c0a1 100644 --- a/packages/adapter-static/test/apps/spa/src/routes/+page.svelte +++ b/packages/adapter-static/test/apps/spa/src/routes/+page.svelte @@ -1 +1 @@ -

This page was not prerendered

\ No newline at end of file +

This page was not prerendered

diff --git a/packages/adapter-static/test/apps/spa/src/routes/about/+page.svelte b/packages/adapter-static/test/apps/spa/src/routes/about/+page.svelte index 404fd77511d2..07dd2ffa5038 100644 --- a/packages/adapter-static/test/apps/spa/src/routes/about/+page.svelte +++ b/packages/adapter-static/test/apps/spa/src/routes/about/+page.svelte @@ -1 +1 @@ -

This page was prerendered

\ No newline at end of file +

This page was prerendered

diff --git a/packages/adapter-vercel/package.json b/packages/adapter-vercel/package.json index e9af9d7f78f2..db4239f8c618 100644 --- a/packages/adapter-vercel/package.json +++ b/packages/adapter-vercel/package.json @@ -25,7 +25,7 @@ "index.d.ts" ], "scripts": { - "lint": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore", + "lint": "prettier --check .", "format": "pnpm lint --write", "check": "tsc", "test": "vitest run" diff --git a/packages/amp/package.json b/packages/amp/package.json index c204ba87f343..d8740cc5aeb1 100644 --- a/packages/amp/package.json +++ b/packages/amp/package.json @@ -23,7 +23,7 @@ "index.d.ts" ], "scripts": { - "lint": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore", + "lint": "prettier --check .", "format": "pnpm lint --write" }, "peerDependencies": { diff --git a/packages/create-svelte/.gitignore b/packages/create-svelte/.gitignore index 46c461e5b123..14b636183d83 100644 --- a/packages/create-svelte/.gitignore +++ b/packages/create-svelte/.gitignore @@ -11,4 +11,4 @@ /templates/*/.vercel_build_output /templates/*/.netlify /templates/*/dist -/templates/*/package \ No newline at end of file +/templates/*/package diff --git a/packages/create-svelte/package.json b/packages/create-svelte/package.json index e73b7e89f17c..c6c97be09957 100644 --- a/packages/create-svelte/package.json +++ b/packages/create-svelte/package.json @@ -18,10 +18,9 @@ "devDependencies": { "@playwright/test": "1.30.0", "@types/gitignore-parser": "^0.0.2", - "@types/prettier": "^2.7.1", "gitignore-parser": "^0.0.2", - "prettier": "^2.8.0", - "prettier-plugin-svelte": "^2.10.1", + "prettier": "^3.1.0", + "prettier-plugin-svelte": "^3.0.0", "sucrase": "^3.29.0", "svelte": "^4.2.2", "tiny-glob": "^0.2.9", @@ -31,7 +30,7 @@ "build": "node scripts/build-templates", "test": "pnpm build && vitest run", "check": "tsc", - "lint": "prettier --check . --config ../../.prettierrc --ignore-path ../../.gitignore --ignore-path .gitignore --plugin prettier-plugin-svelte --plugin-search-dir=.", + "lint": "prettier --check . --config ../../.prettierrc --ignore-path ../../.gitignore --ignore-path .gitignore", "format": "pnpm lint --write", "prepublishOnly": "pnpm build", "postpublish": "echo \"Updating template repo\" && bash ./scripts/update-template-repo.sh" diff --git a/packages/create-svelte/scripts/build-templates.js b/packages/create-svelte/scripts/build-templates.js index 1371f78178f2..4e07dfa0fc99 100644 --- a/packages/create-svelte/scripts/build-templates.js +++ b/packages/create-svelte/scripts/build-templates.js @@ -7,7 +7,7 @@ import glob from 'tiny-glob/sync.js'; import { mkdirp, rimraf } from '../utils.js'; /** @param {string} content */ -function convert_typescript(content) { +async function convert_typescript(content) { let { code } = transform(content, { transforms: ['typescript'], disableESTransforms: true @@ -19,7 +19,7 @@ function convert_typescript(content) { // Prettier strips 'unnecessary' parens from .ts files, we need to hack them back in code = code.replace(/(\/\*\* @type.+? \*\/) (.+?) \/\*\*\*\//g, '$1($2)'); - return prettier.format(code, { + return await prettier.format(code, { parser: 'babel', useTabs: true, singleQuote: true, @@ -78,7 +78,8 @@ async function generate_templates(shared) { null: [] }; - glob('**/*', { cwd, filesOnly: true, dot: true }).forEach((name) => { + const files = glob('**/*', { cwd, filesOnly: true, dot: true }); + for (const name of files) { // the package.template.json thing is a bit annoying — basically we want // to be able to develop and deploy the app from here, but have a different // package.json in newly created projects (based on package.template.json) @@ -87,14 +88,14 @@ async function generate_templates(shared) { // TODO package-specific versions contents = contents.replace(/workspace:\*/g, 'next'); fs.writeFileSync(`${dir}/package.json`, contents); - return; + continue; } // ignore files that are written conditionally - if (shared.has(name)) return; + if (shared.has(name)) continue; // ignore contents of .gitignore or .ignore - if (!gitignore.accepts(name) || !ignore.accepts(name) || name === '.ignore') return; + if (!gitignore.accepts(name) || !ignore.accepts(name) || name === '.ignore') continue; if (/\.(ts|svelte)$/.test(name)) { const contents = fs.readFileSync(path.join(cwd, name), 'utf8'); @@ -103,7 +104,7 @@ async function generate_templates(shared) { if (name.endsWith('app.d.ts')) types.checkjs.push({ name, contents }); types.typescript.push({ name, contents }); } else if (name.endsWith('.ts')) { - const js = convert_typescript(contents); + const js = await convert_typescript(contents); types.typescript.push({ name, @@ -125,9 +126,14 @@ async function generate_templates(shared) { // possible (e.g. preserving double line breaks). Sucrase is the best // tool for the job because it just removes the types; Prettier then // tidies up the end result - const js_contents = contents.replace( + const js_contents = await replace_async( + contents, /]+)>([\s\S]+?)<\/script>/g, - (m, attrs, typescript) => { + async ( + /** @type {any} */ m, + /** @type {string} */ attrs, + /** @type {string} */ typescript + ) => { // Sucrase assumes 'unused' imports (which _are_ used, but only // in the markup) are type imports, and strips them. This step // prevents it from drawing that conclusion @@ -149,14 +155,15 @@ async function generate_templates(shared) { disableESTransforms: true }).code.slice(0, -suffix.length); - const contents = prettier - .format(transformed, { + const contents = ( + await prettier.format(transformed, { parser: 'babel', useTabs: true, singleQuote: true, trailingComma: 'none', printWidth: 100 }) + ) .trim() .replace(/^(.)/gm, '\t$1'); @@ -184,7 +191,7 @@ async function generate_templates(shared) { mkdirp(path.dirname(dest)); fs.copyFileSync(path.join(cwd, name), dest); } - }); + } fs.copyFileSync(meta_file, `${dir}/meta.json`); fs.writeFileSync( @@ -196,6 +203,20 @@ async function generate_templates(shared) { } } +/** + * @param {string} string + * @param {RegExp} regexp + * @param {{ (m: any, attrs: string, typescript: string): Promise; (arg0: any): any; }} replacer + */ +async function replace_async(string, regexp, replacer) { + const replacements = await Promise.all( + // @ts-ignore + Array.from(string.matchAll(regexp), (match) => replacer(...match)) + ); + let i = 0; + return string.replace(regexp, () => replacements[i++]); +} + async function generate_shared() { const cwd = path.resolve('shared'); @@ -205,7 +226,8 @@ async function generate_shared() { /** @type {Array<{ name: string, include: string[], exclude: string[], contents: string }>} */ const files = []; - glob('**/*', { cwd, filesOnly: true, dot: true }).forEach((file) => { + const globbed = glob('**/*', { cwd, filesOnly: true, dot: true }); + for (const file of globbed) { const contents = fs.readFileSync(path.join(cwd, file), 'utf8'); /** @type {string[]} */ @@ -232,7 +254,7 @@ async function generate_shared() { if (name.endsWith('.ts') && !include.includes('typescript')) { // file includes types in TypeScript and JSDoc — // create .js file, with and without JSDoc - const js = convert_typescript(contents); + const js = await convert_typescript(contents); const js_name = name.replace(/\.ts$/, '.js'); // typescript @@ -265,7 +287,7 @@ async function generate_shared() { shared.add(name); files.push({ name, include, exclude, contents }); } - }); + } files.sort((a, b) => a.include.length + a.exclude.length - (b.include.length + b.exclude.length)); diff --git a/packages/create-svelte/shared/+eslint+prettier/package.json b/packages/create-svelte/shared/+eslint+prettier/package.json index 808ff280d4b8..3dca8ba8215f 100644 --- a/packages/create-svelte/shared/+eslint+prettier/package.json +++ b/packages/create-svelte/shared/+eslint+prettier/package.json @@ -3,7 +3,7 @@ "eslint-config-prettier": "^8.5.0" }, "scripts": { - "lint": "prettier --plugin-search-dir . --check . && eslint .", - "format": "prettier --plugin-search-dir . --write ." + "lint": "prettier --check . && eslint .", + "format": "prettier --write ." } } diff --git a/packages/create-svelte/shared/+prettier/.prettierrc b/packages/create-svelte/shared/+prettier/.prettierrc index a77fddea9097..95730232b6b1 100644 --- a/packages/create-svelte/shared/+prettier/.prettierrc +++ b/packages/create-svelte/shared/+prettier/.prettierrc @@ -4,6 +4,5 @@ "trailingComma": "none", "printWidth": 100, "plugins": ["prettier-plugin-svelte"], - "pluginSearchDirs": ["."], "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] } diff --git a/packages/create-svelte/shared/+prettier/package.json b/packages/create-svelte/shared/+prettier/package.json index e368023fb43e..60af3f611a0f 100644 --- a/packages/create-svelte/shared/+prettier/package.json +++ b/packages/create-svelte/shared/+prettier/package.json @@ -1,6 +1,6 @@ { "devDependencies": { - "prettier": "^2.8.0", - "prettier-plugin-svelte": "^2.10.1" + "prettier": "^3.0.0", + "prettier-plugin-svelte": "^3.0.0" } } diff --git a/packages/create-svelte/shared/-eslint+prettier/package.json b/packages/create-svelte/shared/-eslint+prettier/package.json index 0193de97cbb4..bcdff7cf9402 100644 --- a/packages/create-svelte/shared/-eslint+prettier/package.json +++ b/packages/create-svelte/shared/-eslint+prettier/package.json @@ -1,6 +1,6 @@ { "scripts": { - "lint": "prettier --plugin-search-dir . --check .", - "format": "prettier --plugin-search-dir . --write ." + "lint": "prettier --check .", + "format": "prettier --write ." } } diff --git a/packages/create-svelte/templates/default/src/app.html b/packages/create-svelte/templates/default/src/app.html index 6769ed5e89c5..77a5ff52c923 100644 --- a/packages/create-svelte/templates/default/src/app.html +++ b/packages/create-svelte/templates/default/src/app.html @@ -1,4 +1,4 @@ - + diff --git a/packages/create-svelte/templates/skeleton/src/app.html b/packages/create-svelte/templates/skeleton/src/app.html index 6769ed5e89c5..77a5ff52c923 100644 --- a/packages/create-svelte/templates/skeleton/src/app.html +++ b/packages/create-svelte/templates/skeleton/src/app.html @@ -1,4 +1,4 @@ - + diff --git a/packages/create-svelte/templates/skeletonlib/src/app.html b/packages/create-svelte/templates/skeletonlib/src/app.html index d2fc6b061c6a..f22aeaad5e39 100644 --- a/packages/create-svelte/templates/skeletonlib/src/app.html +++ b/packages/create-svelte/templates/skeletonlib/src/app.html @@ -1,4 +1,4 @@ - + diff --git a/packages/enhanced-img/.prettierignore b/packages/enhanced-img/.prettierignore new file mode 100644 index 000000000000..57a5af7f662f --- /dev/null +++ b/packages/enhanced-img/.prettierignore @@ -0,0 +1 @@ +test/Output.svelte diff --git a/packages/enhanced-img/package.json b/packages/enhanced-img/package.json index fdfaa92e588f..b8a6f5b7224c 100644 --- a/packages/enhanced-img/package.json +++ b/packages/enhanced-img/package.json @@ -11,9 +11,9 @@ "homepage": "https://kit.svelte.dev", "type": "module", "scripts": { - "lint": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore", + "lint": "prettier --check .", "check": "tsc", - "format": "prettier --write . --config ../../.prettierrc --ignore-path .gitignore", + "format": "prettier --write .", "test": "vitest" }, "files": [ diff --git a/packages/enhanced-img/test/Input.svelte b/packages/enhanced-img/test/Input.svelte index 5c16263938ee..74f6320c9acb 100644 --- a/packages/enhanced-img/test/Input.svelte +++ b/packages/enhanced-img/test/Input.svelte @@ -2,12 +2,9 @@ import manual_image1 from './no.png'; import manual_image2 from './no.svg'; - const images = [ - manual_image1, - manual_image2 - ]; + const images = [manual_image1, manual_image2]; - let foo: string = 'bar' + let foo: string = 'bar'; {foo} @@ -18,15 +15,17 @@ - - - + - + - + diff --git a/packages/enhanced-img/test/Output.svelte b/packages/enhanced-img/test/Output.svelte index 29aee1fb6def..832e7c453b61 100644 --- a/packages/enhanced-img/test/Output.svelte +++ b/packages/enhanced-img/test/Output.svelte @@ -2,12 +2,9 @@ import manual_image1 from './no.png'; import manual_image2 from './no.svg'; - const images = [ - manual_image1, - manual_image2 - ]; + const images = [manual_image1, manual_image2]; - let foo: string = 'bar' + let foo: string = 'bar'; {foo} @@ -18,15 +15,13 @@ dimensions test -unquoted dimensions test - directive test -spread attributes test +spread attributes test sizes test -event handler test +event handler test alias test diff --git a/packages/kit/.prettierignore b/packages/kit/.prettierignore new file mode 100644 index 000000000000..8275c27b66be --- /dev/null +++ b/packages/kit/.prettierignore @@ -0,0 +1 @@ +test/build-errors/apps/syntax-error/src/routes/+page.svelte diff --git a/packages/kit/package.json b/packages/kit/package.json index c786719ccf42..cd2662661881 100644 --- a/packages/kit/package.json +++ b/packages/kit/package.json @@ -56,10 +56,10 @@ "postinstall.js" ], "scripts": { - "lint": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore", + "lint": "prettier --config ../../.prettierrc --check .", "check": "tsc", "check:all": "tsc && pnpm -r --filter=\"./**\" check", - "format": "prettier --write . --config ../../.prettierrc --ignore-path .gitignore", + "format": "prettier --config ../../.prettierrc --write .", "test": "pnpm test:unit && pnpm test:integration", "test:integration": "pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test", "test:cross-platform:dev": "pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test:cross-platform:dev", diff --git a/packages/kit/src/core/config/default-error.html b/packages/kit/src/core/config/default-error.html index 12d998b4bc32..c322e1682478 100644 --- a/packages/kit/src/core/config/default-error.html +++ b/packages/kit/src/core/config/default-error.html @@ -1,4 +1,4 @@ - + @@ -11,8 +11,18 @@ --divider: #ccc; background: var(--bg); color: var(--fg); - font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, - Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; + font-family: + system-ui, + -apple-system, + BlinkMacSystemFont, + 'Segoe UI', + Roboto, + Oxygen, + Ubuntu, + Cantarell, + 'Open Sans', + 'Helvetica Neue', + sans-serif; display: flex; align-items: center; justify-content: center; diff --git a/packages/kit/src/core/sync/write_tsconfig.js b/packages/kit/src/core/sync/write_tsconfig.js index 871117b18127..8489b933cc3b 100644 --- a/packages/kit/src/core/sync/write_tsconfig.js +++ b/packages/kit/src/core/sync/write_tsconfig.js @@ -181,8 +181,8 @@ function validate_user_config(kit, cwd, out, config) { typeof extend === 'string' ? path.resolve(cwd, extend) === out : Array.isArray(extend) - ? extend.some((e) => path.resolve(cwd, e) === out) - : false; + ? extend.some((e) => path.resolve(cwd, e) === out) + : false; const options = config.options.compilerOptions || {}; diff --git a/packages/kit/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/+layout.svelte b/packages/kit/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/+layout.svelte index 23addb029828..1072c0a6c0a7 100644 --- a/packages/kit/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/+layout.svelte +++ b/packages/kit/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/+layout.svelte @@ -1 +1 @@ -export function load() {} +export function load() {} diff --git a/packages/kit/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/nested/+layout.svelte b/packages/kit/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/nested/+layout.svelte index 23addb029828..1072c0a6c0a7 100644 --- a/packages/kit/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/nested/+layout.svelte +++ b/packages/kit/src/core/sync/write_types/test/slugs-layout-not-all-pages-have-load/nested/+layout.svelte @@ -1 +1 @@ -export function load() {} +export function load() {} diff --git a/packages/kit/src/core/sync/write_types/test/slugs/+layout.svelte b/packages/kit/src/core/sync/write_types/test/slugs/+layout.svelte index 23addb029828..1072c0a6c0a7 100644 --- a/packages/kit/src/core/sync/write_types/test/slugs/+layout.svelte +++ b/packages/kit/src/core/sync/write_types/test/slugs/+layout.svelte @@ -1 +1 @@ -export function load() {} +export function load() {} diff --git a/packages/kit/src/exports/public.d.ts b/packages/kit/src/exports/public.d.ts index d3bbaed15469..77f15a391898 100644 --- a/packages/kit/src/exports/public.d.ts +++ b/packages/kit/src/exports/public.d.ts @@ -42,12 +42,12 @@ export interface Adapter { type AwaitedPropertiesUnion | void> = input extends void ? undefined // needs to be undefined, because void will break intellisense : input extends Record - ? { - [key in keyof input]: Awaited; - } - : {} extends input // handles the any case - ? input - : unknown; + ? { + [key in keyof input]: Awaited; + } + : {} extends input // handles the any case + ? input + : unknown; export type AwaitedProperties | void> = AwaitedPropertiesUnion extends Record @@ -70,8 +70,8 @@ type OptionalUnion< type UnpackValidationError = T extends ActionFailure ? X : T extends void - ? undefined // needs to be undefined, because void will corrupt union type - : T; + ? undefined // needs to be undefined, because void will corrupt union type + : T; /** * This object is passed to the `adapt` function of adapters. diff --git a/packages/kit/src/runtime/client/client.js b/packages/kit/src/runtime/client/client.js index 80abcfd65742..b2229b421cf4 100644 --- a/packages/kit/src/runtime/client/client.js +++ b/packages/kit/src/runtime/client/client.js @@ -535,10 +535,10 @@ export function create_client(app, target) { typeof data !== 'object' ? `a ${typeof data}` : data instanceof Response - ? 'a Response object' - : Array.isArray(data) - ? 'an array' - : 'a non-plain object' + ? 'a Response object' + : Array.isArray(data) + ? 'an array' + : 'a non-plain object' }, but must return a plain object at the top level (i.e. \`return {...}\`)` ); } diff --git a/packages/kit/src/runtime/components/layout.svelte b/packages/kit/src/runtime/components/layout.svelte index 49aeb95a1db9..4fa864ce7aa9 100644 --- a/packages/kit/src/runtime/components/layout.svelte +++ b/packages/kit/src/runtime/components/layout.svelte @@ -1 +1 @@ - \ No newline at end of file + diff --git a/packages/kit/src/runtime/server/page/load_data.js b/packages/kit/src/runtime/server/page/load_data.js index 1dbabbe2766c..e24dad5b3bed 100644 --- a/packages/kit/src/runtime/server/page/load_data.js +++ b/packages/kit/src/runtime/server/page/load_data.js @@ -359,10 +359,10 @@ function validate_load_response(data, routeId) { typeof data !== 'object' ? `a ${typeof data}` : data instanceof Response - ? 'a Response object' - : Array.isArray(data) - ? 'an array' - : 'a non-plain object' + ? 'a Response object' + : Array.isArray(data) + ? 'an array' + : 'a non-plain object' }, but must return a plain object at the top level (i.e. \`return {...}\`)` ); } diff --git a/packages/kit/src/runtime/server/respond.js b/packages/kit/src/runtime/server/respond.js index 44b0e19a6975..22fadabf38d3 100644 --- a/packages/kit/src/runtime/server/respond.js +++ b/packages/kit/src/runtime/server/respond.js @@ -341,8 +341,8 @@ export async function respond(request, options, manifest, state) { const response = is_data_request ? redirect_json_response(e) : route?.page && is_action_json_request(event) - ? action_json_redirect(e) - : redirect_response(e.status, e.location); + ? action_json_redirect(e) + : redirect_response(e.status, e.location); add_cookies_to_headers(response.headers, Object.values(cookies_to_add)); return response; } diff --git a/packages/kit/test/apps/amp/src/app.html b/packages/kit/test/apps/amp/src/app.html index da318e7a69d2..b8e986c5d51a 100644 --- a/packages/kit/test/apps/amp/src/app.html +++ b/packages/kit/test/apps/amp/src/app.html @@ -1,4 +1,4 @@ - + diff --git a/packages/kit/test/apps/amp/src/routes/+layout.svelte b/packages/kit/test/apps/amp/src/routes/+layout.svelte index f7c91b7e246a..3d931ed395d6 100644 --- a/packages/kit/test/apps/amp/src/routes/+layout.svelte +++ b/packages/kit/test/apps/amp/src/routes/+layout.svelte @@ -1,4 +1,4 @@ - +
footer