From b8d3c7dd50e662b19cf2d19dbdc7b9055bc531cf Mon Sep 17 00:00:00 2001 From: Max Duval Date: Mon, 9 Dec 2024 01:28:05 +0000 Subject: [PATCH] Allow suspicious coalescing (#62) - explain why: this is what Svelte does for templates - bump Svelte to v5.90 - bump version to v0.8.6 --- .zed/settings.json | 34 ++++++++++++++++++++++++++++++++++ deno.json | 8 ++++---- deno.lock | 8 ++++---- src/build.ts | 8 ++++++++ 4 files changed, 50 insertions(+), 8 deletions(-) diff --git a/.zed/settings.json b/.zed/settings.json index af73df5..6f2b201 100644 --- a/.zed/settings.json +++ b/.zed/settings.json @@ -1,5 +1,39 @@ { "languages": { + "JSONC": { + "prettier": { + "allowed": false + }, + "formatter": { + "external": { + "command": "deno", + "arguments": ["fmt", "-"] + } + }, + "format_on_save": { + "external": { + "command": "deno", + "arguments": ["fmt", "-"] + } + } + }, + "JSON": { + "prettier": { + "allowed": false + }, + "formatter": { + "external": { + "command": "deno", + "arguments": ["fmt", ""] + } + }, + "format_on_save": { + "external": { + "command": "deno", + "arguments": ["fmt", "-"] + } + } + }, "JavaScript": { "language_servers": [ "deno", diff --git a/deno.json b/deno.json index e014da5..5119491 100644 --- a/deno.json +++ b/deno.json @@ -1,11 +1,11 @@ { "name": "@mxdvl/mononykus", - "version": "0.8.5", + "version": "0.8.6", "license": "MIT", "exports": "./src/build.ts", "tasks": { - "build": "deno run -A src/build.ts --site_dir src/_site", - "dev": "deno run -A src/build.ts --site_dir src/_site --watch --base=mononykus" + "build": "NODE_ENV=production deno run -A src/build.ts --site_dir src/_site", + "dev": "NODE_ENV=development deno run -A src/build.ts --site_dir src/_site --watch --base=mononykus" }, "compilerOptions": { "strict": true, @@ -29,6 +29,6 @@ "@std/path": "jsr:@std/path@^1.0.6", "esbuild": "npm:esbuild@~0.24.0", "prettier": "npm:prettier@^3.0.2", - "svelte": "npm:svelte@5.7.1" + "svelte": "npm:svelte@5.9.0" } } diff --git a/deno.lock b/deno.lock index 28cdcee..2800971 100644 --- a/deno.lock +++ b/deno.lock @@ -20,7 +20,7 @@ "jsr:@std/streams@^1.0.8": "1.0.8", "npm:esbuild@0.24": "0.24.0", "npm:prettier@^3.0.2": "3.4.1", - "npm:svelte@5.7.1": "5.7.1_acorn@8.14.0" + "npm:svelte@5.9.0": "5.9.0_acorn@8.14.0" }, "jsr": { "@luca/esbuild-deno-loader@0.11.0": { @@ -269,8 +269,8 @@ "prettier@3.4.1": { "integrity": "sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg==" }, - "svelte@5.7.1_acorn@8.14.0": { - "integrity": "sha512-kUtiiNcN7ssi5X8OQW8IILoI53RUudjn8TD1910i8cg5c5IRZ4IuaDO1vFl+kZcvv1geYBxlFpi/mj09m/CCBg==", + "svelte@5.9.0_acorn@8.14.0": { + "integrity": "sha512-ZcC3BtjIDa4yfhAyAr94MxDQLD97zbpXmaUldFv2F5AkdZwYgQYB3BZVNRU5zEVaeeHoAns8ADiRMnre3QmpxQ==", "dependencies": [ "@ampproject/remapping", "@jridgewell/sourcemap-codec", @@ -301,7 +301,7 @@ "jsr:@std/path@^1.0.6", "npm:esbuild@0.24", "npm:prettier@^3.0.2", - "npm:svelte@5.7.1" + "npm:svelte@5.9.0" ] } } diff --git a/src/build.ts b/src/build.ts index 853027f..d98ab32 100644 --- a/src/build.ts +++ b/src/build.ts @@ -8,6 +8,7 @@ import { svelte_components } from "./esbuild_plugins/svelte_components.ts"; import { create_handler } from "./server.ts"; import { write_islands } from "./esbuild_plugins/write_islands.ts"; import { svelte_modules } from "./esbuild_plugins/svelte_modules.ts"; +import { VERSION } from "svelte/compiler"; function slashify(path: string): string { return normalize(path + "/"); @@ -89,6 +90,11 @@ export const rebuild = async ({ minify, bundle: true, conditions: [flags.watch ? "development" : "production"], + logOverride: { + // Svelte does this a lot for its templates + // e.g. `$.get(value) ?? ""` + "suspicious-nullish-coalescing": "verbose", + }, } as const satisfies Partial; const routesESBuildConfig: esbuild.BuildOptions = { @@ -139,6 +145,8 @@ export const build = async ( const out_dir = slashify(_out_dir); const site_dir = slashify(_site_dir); + console.info(`\nMononykus: building with Svelte v${VERSION}\n\n`); + await clean(out_dir); await rebuild({ base, out_dir, site_dir, minify });