chore: fix prettier ignoring source code in with build in the name (#15133)
authorTee Ming <chewteeming01@gmail.com>
Fri, 9 Jan 2026 00:44:55 +0000 (08:44 +0800)
committerGitHub <noreply@github.com>
Fri, 9 Jan 2026 00:44:55 +0000 (19:44 -0500)
* avoid prettier ignoring files that contain build in their name

* fix global ignore ignoring directories with build name

* prettier

* Update .prettierignore

* Update .prettierignore

.prettierrc
packages/kit/.prettierignore
packages/kit/src/exports/vite/build/build_server.js
packages/kit/src/exports/vite/build/utils.js

index fc699c71d960bb56402eecbb6d8992b96f64221a..9f806b7df2d46c463869bd4b996f9f645dbd2cb2 100644 (file)
@@ -24,7 +24,6 @@
                                "**/vite.config.js.timestamp-*",
                                "**/.svelte-kit/**",
                                "**/.custom-out-dir/**",
-                               "**/build/**",
                                "**/test-results/**",
                                "**/.wrangler/**",
                                "documentation/**/*.md",
@@ -32,7 +31,8 @@
                                "packages/package/test/watch/expected/**/*",
                                "packages/package/test/watch/package/**/*",
                                "packages/kit/src/core/postbuild/fixtures/**/*",
-                               "packages/adapter-cloudflare/test/apps/workers/dist/**/*"
+                               "packages/adapter-cloudflare/test/apps/workers/dist/**/*",
+                               "packages/*/test/**/build"
                        ],
                        "options": {
                                "rangeEnd": 0
index e0904af006f227a0eeebf19a4d2d34a39e4cf41a..2da9e831cad86ec99a1d07f8b13622e8570a25ce 100644 (file)
@@ -1,8 +1,7 @@
-test/build-errors/apps/syntax-error/src/routes/+page.svelte
 /types
-src/runtime/components/svelte-5/layout.svelte
+/src/runtime/components/svelte-5/layout.svelte
 .svelte-kit
 .custom-out-dir
-build
 test-results
 /test/apps/basics/test/errors.json
+/test/build-errors/apps/syntax-error/src/routes/+page.svelte
index 7af4073ef09d6ee4b5073989150fd852c7797510..6a1e13fcc2b1a6b8f8c67da5d247acf32a424320 100644 (file)
@@ -6,7 +6,6 @@ import { normalizePath } from 'vite';
 import { basename, join } from 'node:path';
 import { create_node_analyser } from '../static_analysis/index.js';
 
-
 /**
  * @param {string} out
  * @param {import('types').ValidatedKitConfig} kit
@@ -18,7 +17,17 @@ import { create_node_analyser } from '../static_analysis/index.js';
  * @param {import('types').RecursiveRequired<import('types').ValidatedConfig['kit']['output']>} output_config
  * @param {Map<string, { page_options: Record<string, any> | null, children: string[] }>} static_exports
  */
-export async function build_server_nodes(out, kit, manifest_data, server_manifest, client_manifest, server_bundle, client_chunks, output_config, static_exports) {
+export async function build_server_nodes(
+       out,
+       kit,
+       manifest_data,
+       server_manifest,
+       client_manifest,
+       server_bundle,
+       client_chunks,
+       output_config,
+       static_exports
+) {
        mkdirp(`${out}/server/nodes`);
        mkdirp(`${out}/server/stylesheets`);
 
@@ -37,7 +46,7 @@ export async function build_server_nodes(out, kit, manifest_data, server_manifes
                        }
                        client_stylesheet.forEach((file, i) => {
                                stylesheets_to_inline.set(file, server_stylesheet[i]);
-                       }) 
+                       });
                }
 
                // filter out stylesheets that should not be inlined
@@ -60,7 +69,9 @@ export async function build_server_nodes(out, kit, manifest_data, server_manifes
        const { get_page_options } = create_node_analyser({
                resolve: (server_node) => {
                        // Windows needs the file:// protocol for absolute path dynamic imports
-                       return import(`file://${join(out, 'server', resolve_symlinks(server_manifest, server_node).chunk.file)}`);
+                       return import(
+                               `file://${join(out, 'server', resolve_symlinks(server_manifest, server_node).chunk.file)}`
+                       );
                },
                static_exports
        });
@@ -97,7 +108,7 @@ export async function build_server_nodes(out, kit, manifest_data, server_manifes
                if (node.universal) {
                        const page_options = await get_page_options(node);
                        if (!!page_options && page_options.ssr === false) {
-                               exports.push(`export const universal = ${s(page_options, null, 2)};`)
+                               exports.push(`export const universal = ${s(page_options, null, 2)};`);
                        } else {
                                imports.push(
                                        `import * as universal from '../${resolve_symlinks(server_manifest, node.universal).chunk.file}';`
@@ -116,14 +127,18 @@ export async function build_server_nodes(out, kit, manifest_data, server_manifes
                        exports.push(`export const server_id = ${s(node.server)};`);
                }
 
-               if (client_manifest && (node.universal || node.component) && output_config.bundleStrategy === 'split') {
+               if (
+                       client_manifest &&
+                       (node.universal || node.component) &&
+                       output_config.bundleStrategy === 'split'
+               ) {
                        const entry_path = `${normalizePath(kit.outDir)}/generated/client-optimized/nodes/${i}.js`;
                        const entry = find_deps(client_manifest, entry_path, true);
 
                        // eagerly load client stylesheets and fonts imported by the SSR-ed page to avoid FOUC.
                        // However, if it is not used during SSR (not present in the server manifest),
                        // then it can be lazily loaded in the browser.
-       
+
                        /** @type {import('types').AssetDependencies | undefined} */
                        let component;
                        if (node.component) {
@@ -149,8 +164,8 @@ export async function build_server_nodes(out, kit, manifest_data, server_manifes
                                }
 
                                if (component?.stylesheet_map.has(filepath) || universal?.stylesheet_map.has(filepath)) {
-                                       value.css.forEach(file => eager_css.add(file));
-                                       value.assets.forEach(file => eager_assets.add(file));
+                                       value.css.forEach((file) => eager_css.add(file));
+                                       value.assets.forEach((file) => eager_assets.add(file));
                                }
                        });
 
@@ -196,7 +211,7 @@ export async function build_server_nodes(out, kit, manifest_data, server_manifes
 }
 
 /**
- * @param {(import('vite').Rollup.OutputAsset | import('vite').Rollup.OutputChunk)[]} chunks 
+ * @param {(import('vite').Rollup.OutputAsset | import('vite').Rollup.OutputChunk)[]} chunks
  */
 function get_stylesheets(chunks) {
        /**
@@ -222,7 +237,7 @@ function get_stylesheets(chunks) {
                if (chunk.viteMetadata?.importedCss.size) {
                        const css = Array.from(chunk.viteMetadata.importedCss);
                        for (const id of chunk.moduleIds) {
-                               stylesheets_used.set(id, css );
+                               stylesheets_used.set(id, css);
                        }
                }
        }
index 9bac4587d3d11e4ea9cb5834a9a889cca88d41dc..143e3e1403d2eed84397881f2eff6d4a5828036f 100644 (file)
@@ -40,7 +40,7 @@ export function find_deps(manifest, entry, add_dynamic_css) {
                if (add_js) imports.add(chunk.file);
 
                if (chunk.assets) {
-                       chunk.assets.forEach(asset => imported_assets.add(asset));
+                       chunk.assets.forEach((asset) => imported_assets.add(asset));
                }
 
                if (chunk.css) {
@@ -48,7 +48,9 @@ export function find_deps(manifest, entry, add_dynamic_css) {
                }
 
                if (chunk.imports) {
-                       chunk.imports.forEach((file) => traverse(file, add_js, initial_importer, dynamic_import_depth));
+                       chunk.imports.forEach((file) =>
+                               traverse(file, add_js, initial_importer, dynamic_import_depth)
+                       );
                }
 
                if (!add_dynamic_css) return;
@@ -58,7 +60,9 @@ export function find_deps(manifest, entry, add_dynamic_css) {
                        // a transitive dependency, it doesn't have a suitable name we can map back to
                        // the server manifest
                        if (stylesheet_map.has(initial_importer)) {
-                               const { css, assets } = /** @type {{ css: Set<string>; assets: Set<string> }} */ (stylesheet_map.get(initial_importer));
+                               const { css, assets } = /** @type {{ css: Set<string>; assets: Set<string> }} */ (
+                                       stylesheet_map.get(initial_importer)
+                               );
                                if (chunk.css) chunk.css.forEach((file) => css.add(file));
                                if (chunk.assets) chunk.assets.forEach((file) => assets.add(file));
                        } else {
@@ -111,14 +115,14 @@ export function resolve_symlinks(manifest, file) {
 }
 
 /**
- * @param {string[]} assets 
+ * @param {string[]} assets
  * @returns {string[]}
  */
 export function filter_fonts(assets) {
        return assets.filter((asset) => /\.(woff2?|ttf|otf)$/.test(asset));
 }
 
-const method_names = new Set((['GET', 'HEAD', 'PUT', 'POST', 'DELETE', 'PATCH', 'OPTIONS']));
+const method_names = new Set(['GET', 'HEAD', 'PUT', 'POST', 'DELETE', 'PATCH', 'OPTIONS']);
 
 // If we'd written this in TypeScript, it could be easy...
 /**