Commit Graph
98 Commits
Author SHA1 Message Date
Bartek IwańczukandClaude Opus 4.6 689f1881e2 chore: update lockfile, fix CI integrity checks, remove deploy workflow (#3698)
## Summary
- Refresh `deno.lock` to pick up latest dependency resolutions (notably
preact 10.28.2 → 10.29.0, new `@deno/graph` and `@std/json` entries)
- Fix stale integrity hashes for `raw.githubusercontent.com` remote
specifiers (`check_docs.ts`, `utils.ts`) that point to branch HEAD
- Run `deno fmt` on `www/static/docsearch.css` and
`www/static/markdown.css`
- Remove `deploy.yml` workflow — Deno Deploy now uses its built-in
GitHub integration

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 18:47:56 +01:00
Marvin Hagemeister 9f68496aa9 chore: update lockfile (#3677) 2026-02-11 14:13:35 +01:00
Marvin Hagemeister 89ddbc4f4b chore: update preact version (#3664) 2026-01-07 14:17:59 +01:00
Eli ab14d1044c refactor(vite): replace old environment APIs (#3634)
I was perusing the code whilst investigating #3606 and noticed that,
despite the release post claiming that Fresh had ["fully
embrace[d]"](https://deno.com/blog/fresh-and-vite#:~:text=fully%20embraces)
the Vite Environment API, it was still using `ssrLoadModule`. Once I
started looking, I noticed a bunch of other code that wasn't
future-proof (env-wise, not rolldown-wise, which'll bring it's own swath
of deprecations[^1]), so I updated them as well.

The newly added source map tests from #3624 currently fail again because
the ModuleRunner API at the heart of the Environment API relies on
[`process.setSourceMapsEnabled`](https://docs.deno.com/api/node/process/~/Process.setSourceMapsEnabled),
which is [currently set to
no-op](https://github.com/denoland/deno/pull/22993) in Deno.

[^1]: Separately tried to try out rolldown-vite but it seems that Deno
doesn't support aliasing dependencies whatsoever? (I know there's not
official support, but I was going to try to edit the lockfile to hack
around it; however, it seems that there's not alias support in there at
all?)
2025-12-09 13:00:36 +01:00
Marvin Hagemeister 68e70858aa chore: improve init tests (#3590) 2025-10-30 15:49:02 +01:00
Marvin Hagemeister 5e94dfe9fd fix: switch to nodeModulesDir: "manual" (#3588)
The `"auto"` value causes all kinds of race conditions between various
processes trying to auto install their view of dependencies.
2025-10-30 14:50:49 +01:00
Marvin Hagemeister 76dfc65e63 chore: update @astral/astral (#3583) 2025-10-29 17:41:46 +01:00
Marvin Hagemeister 7b6d6315d1 fix(vite): mark transformed cjs with __esModule (#3575)
Fixes https://github.com/denoland/fresh/issues/3565
2025-10-24 19:54:37 +02:00
Marvin Hagemeister 41fba500de fix(init): revert init template to make init work again (#3530)
https://github.com/denoland/fresh/pull/3524 unfortunately introduced a
regression in the init script which breaks it. This was caused by two
independent problems:

1. Only files reachable in the module graph are published, meaning the
templates itself weren't published to JSR
2. When publishing to JSR all specifiers become `https://` internally
which breaks doing path operations like `path.resolve()`,
`path.relative()` and all others. This is something that cannot be
tested locally in advance

Addressing these is going to require a bit of work. The quickest way to
get init working again is to revert it.
2025-10-06 17:48:25 +02:00
fry69 198816b042 feat(init): template based init script (#3524)
Supersedes earlier attempt ->
https://github.com/denoland/fresh/pull/3517

This is now ready for review.

The major upside and motivation for this template based approach is that
it is now possible to view what gets generated in the repository as
actual valid files including syntax highlighting and formatting.

Previously those files where just strings inside the old `init` script,
which is IMHO a nightmare for maintainability.

The approach for this template system is loosely based on Vite's
`create-vite`, which also includes (redundant) templates inside the
repository, see here ->
https://github.com/vitejs/vite/tree/main/packages/create-vite

Included in the tests are compatibility checks against the current
`@fresh/init@2.0.9`, those can get removed at a later point when the
templates start to diverge. They are only included for demonstration
purposes, that this new implementation generates 100% identical output.

This means that the first PR after this got included, which modifies the
templates so the output differs from the old `init` script, also needs
to include:
```shell
rm packages/init/tests/compatibility_test.ts
```

Since this is a rather large PR, it may be more approachable to view the
branch directly ->
https://github.com/fry69/fresh/tree/fry69/refactor-init-template-rename/packages/init

Generated PR message below:

---

Replaces inline string-based project generation with file-based
templates for improved maintainability and extensibility.

### Architecture

**Template structure:**
- `assets/template/` - Complete project templates (vite, vite-tailwind,
builder, builder-tailwind)
- `assets/variants/` - Additive overlays (docker, vscode,
vscode-tailwind)
- `assets/base/` - Common files synced across template variants

Templates use `__VARIABLE__` syntax for substitution (project name,
dependency versions). Files with `__` prefix are renamed to `.` prefix
during generation (e.g., `__gitignore` → .gitignore).

**Template selection logic:**
```
Base: vite|vite-tailwind|builder|builder-tailwind
Variants: +docker, +vscode, +vscode-tailwind
```

### Maintenance workflow

Edit shared files in `assets/base/vite/` or `assets/base/builder/`, then
run `deno task sync` to propagate changes to template variants.
Template-specific files (deno.json, vite.config.ts, styles.css) are
never overwritten.

### Version resolution

Matches existing behavior: only Fresh core version is fetched from JSR,
all other dependencies use fixed versions updated by release scripts.

### Testing

55 tests covering:
- Unit tests for core functionality
- Integration tests (project generation, builds, dev servers)
- CLI argument parsing
- Compatibility tests verifying output matches v2.0.9 (pre-refactor
baseline)
- Template sync workflow

### Breaking changes

None. CLI interface and programmatic API remain identical. Package
publishes to same `@fresh/init` scope at JSR.

### Documentation

- README.md - User-facing usage documentation
- DESIGN.md - Maintainer documentation (architecture, template
maintenance, development setup)
2025-10-06 09:12:07 +02:00
fry69andMarvin Hagemeister f7a2422e93 fix: set nodeModulesDir to manual (#3493)
Hopefully a less invasive fix for #3378

---------

Co-authored-by: Marvin Hagemeister <hello@marvinh.dev>
2025-09-25 20:54:27 +02:00
Marvin Hagemeister 9b83a1e1b3 fix(vite): cover more commonjs cases (#3465)
Fixes https://github.com/denoland/fresh/issues/3463
Fixes https://github.com/denoland/fresh/issues/3449
2025-09-19 18:36:51 +02:00
fry69andgoogle-labs-jules[bot] a12e20d992 fix(init): correct temporary directory creation in tests (#3425)
The tests for the `init` package were failing with a `PermissionDenied`
error in Jules container environment when creating temporary
directories. This was because the tests were attempting to create the
temporary directories in the root of the project, where permissions are
often restricted.

This change corrects the issue by removing the local `withTmpDir` helper
function in `packages/init/src/init_test.ts` and instead using the one
from `../../fresh/src/test_utils.ts`. The shared helper function
correctly creates temporary directories in the operating system's
default temporary directory, which resolves the permission issue.

Sample error message from Jules before this fix:

```
 ERRORS 

init - new project => ./packages/init/src/init_test.ts:99:6
error: PermissionDenied: Permission denied (os error 13): tmpdir
  const dir = await Deno.makeTempDir(options);
                         ^
    at Object.makeTempDir (ext:deno_fs/30_fs.js:168:10)
    at withTmpDir (file:///app/packages/fresh/src/test_utils.ts:136:26)
    at withTmpDir (file:///app/packages/init/src/init_test.ts:41:10)
    at file:///app/packages/init/src/init_test.ts:100:27

init - create project dir => ./packages/init/src/init_test.ts:107:6
error: PermissionDenied: Permission denied (os error 13): tmpdir
  const dir = await Deno.makeTempDir(options);
              ^
    at async withTmpDir (file:///app/packages/fresh/src/test_utils.ts:136:15)
    at async file:///app/packages/init/src/init_test.ts:108:21

init - with tailwind => ./packages/init/src/init_test.ts:122:6
error: PermissionDenied: Permission denied (os error 13): tmpdir
  const dir = await Deno.makeTempDir(options);
                         ^
    at Object.makeTempDir (ext:deno_fs/30_fs.js:168:10)
    at withTmpDir (file:///app/packages/fresh/src/test_utils.ts:136:26)
    at withTmpDir (file:///app/packages/init/src/init_test.ts:41:10)
    at file:///app/packages/init/src/init_test.ts:123:27

init - with vscode => ./packages/init/src/init_test.ts:140:6
error: PermissionDenied: Permission denied (os error 13): tmpdir
  const dir = await Deno.makeTempDir(options);
              ^
    at async withTmpDir (file:///app/packages/fresh/src/test_utils.ts:136:15)
    at async file:///app/packages/init/src/init_test.ts:141:21

init - fmt, lint, and type check project => ./packages/init/src/init_test.ts:153:6
error: PermissionDenied: Permission denied (os error 13): tmpdir
  const dir = await Deno.makeTempDir(options);
              ^
    at async withTmpDir (file:///app/packages/fresh/src/test_utils.ts:136:15)
    at async fn (file:///app/packages/init/src/init_test.ts:159:23)

init with tailwind - fmt, lint, and type check project => ./packages/init/src/init_test.ts:179:6
error: PermissionDenied: Permission denied (os error 13): tmpdir
  const dir = await Deno.makeTempDir(options);
              ^
    at async withTmpDir (file:///app/packages/fresh/src/test_utils.ts:136:15)
    at async file:///app/packages/init/src/init_test.ts:182:23

init - can start dev server => ./packages/init/src/init_test.ts:205:6
error: PermissionDenied: Permission denied (os error 13): tmpdir
  const dir = await Deno.makeTempDir(options);
              ^
    at async withTmpDir (file:///app/packages/fresh/src/test_utils.ts:136:15)
    at async fn (file:///app/packages/init/src/init_test.ts:211:23)

init - can start built project => ./packages/init/src/init_test.ts:233:6
error: PermissionDenied: Permission denied (os error 13): tmpdir
  const dir = await Deno.makeTempDir(options);
              ^
    at async withTmpDir (file:///app/packages/fresh/src/test_utils.ts:136:15)
    at async file:///app/packages/init/src/init_test.ts:234:21

init - errors on missing build cache in prod => ./packages/init/src/init_test.ts:265:6
error: PermissionDenied: Permission denied (os error 13): tmpdir
  const dir = await Deno.makeTempDir(options);
                         ^
    at Object.makeTempDir (ext:deno_fs/30_fs.js:168:10)
    at withTmpDir (file:///app/packages/fresh/src/test_utils.ts:136:26)
    at withTmpDir (file:///app/packages/init/src/init_test.ts:41:10)
    at file:///app/packages/init/src/init_test.ts:266:27

init - with vite => ./packages/init/src/init_test.ts:348:6
error: PermissionDenied: Permission denied (os error 13): tmpdir
  const dir = await Deno.makeTempDir(options);
                         ^
    at Object.makeTempDir (ext:deno_fs/30_fs.js:168:10)
    at withTmpDir (file:///app/packages/fresh/src/test_utils.ts:136:26)
    at withTmpDir (file:///app/packages/init/src/init_test.ts:41:10)
    at file:///app/packages/init/src/init_test.ts:349:27

 FAILURES 

init - new project => ./packages/init/src/init_test.ts:99:6
init - create project dir => ./packages/init/src/init_test.ts:107:6
init - with tailwind => ./packages/init/src/init_test.ts:122:6
init - with vscode => ./packages/init/src/init_test.ts:140:6
init - fmt, lint, and type check project => ./packages/init/src/init_test.ts:153:6
init with tailwind - fmt, lint, and type check project => ./packages/init/src/init_test.ts:179:6
init - can start dev server => ./packages/init/src/init_test.ts:205:6
init - can start built project => ./packages/init/src/init_test.ts:233:6
init - errors on missing build cache in prod => ./packages/init/src/init_test.ts:265:6
init - with vite => ./packages/init/src/init_test.ts:348:6

FAILED | 449 passed (14 steps) | 10 failed | 17 ignored (2m38s)
```

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2025-09-14 11:44:47 +02:00
Marvin Hagemeister ae3db58a99 fix(vite): .env files not being loaded (#3416)
Fixes https://github.com/denoland/fresh/issues/3364
2025-09-12 18:21:51 +02:00
Marvin Hagemeister fb341e4ab7 chore: release 2.0.0 (#3371) 2025-09-09 18:52:36 +02:00
Marvin Hagemeister 79d8cfc3ed docs: make 2.x the default version (#3369) 2025-09-09 14:36:51 +02:00
Marvin Hagemeister 6e9f586c54 chore: release 2.0.0-beta.5 and @fresh/plugin-vite@0.10.2 (#3365)
Fixes https://github.com/denoland/fresh/issues/3363
2025-09-08 22:07:49 +02:00
Marvin Hagemeister 185ab95751 fix(vite): get radix-ui working (#3344) 2025-09-05 16:51:22 +02:00
Marvin Hagemeister 4138b8ca66 fix(vite): improve commonjs handling (#3336)
Fixes https://github.com/denoland/fresh/issues/3323
2025-09-04 12:59:13 +02:00
Marvin Hagemeister b94aab2a1a chore: update to vite's hook filter (#3333)
Fixes https://github.com/denoland/fresh/issues/3331
2025-09-04 11:16:06 +02:00
Marvin Hagemeister fd2ebc63c5 fix(init): setup vite/client types on init (#3327)
Note that this also requires
https://github.com/denoland/deno/issues/30560 to work. That will be
released in either Deno `2.4.6` or `2.5.0` depending on which one comes
first.

Fixes https://github.com/denoland/fresh/issues/3319
2025-09-03 12:02:52 +02:00
Marvin Hagemeister 35f5cc4b7a fix(init): don't show counter value in document title (#3311)
It falsely gives the impression that the value in the document title
would be live.
2025-09-02 15:19:26 +02:00
Marvin Hagemeister 4d463a8e2c chore: update vite 7.1.4 (#3298) 2025-09-02 14:37:36 +02:00
Marvin Hagemeister ff9db336f7 feat(vite): check valid imports per environment (#3299)
Fixes https://github.com/denoland/fresh/issues/3296
2025-09-01 17:30:30 +02:00
Marvin Hagemeister 70bcac298c chore: add @types/node to silence LSP warning (#3293) 2025-09-01 12:15:48 +02:00
Marvin Hagemeister 541bc6c6ca feat(vite): support remote islands (#3294) 2025-09-01 12:11:08 +02:00
Marvin Hagemeister 6c43edf451 www: fix slug (#3287)
Fixes https://github.com/denoland/fresh/issues/3254
2025-09-01 08:14:14 +02:00
Marvin Hagemeisterandfry69 33cb164b7d fix(init): document Vite and ask in init (#3281) (#3286)
Expands #3277

---------

Co-authored-by: fry69 <142489379+fry69@users.noreply.github.com>
2025-09-01 07:58:37 +02:00
Marvin Hagemeister 05203000da feat(init): mark init as stable to make init command shorter (#3274) 2025-08-29 17:50:03 +02:00
Marvin Hagemeister 4fe0199c9f www: port fresh.deno.dev to vite (#3227)
This PR ports fresh.deno.dev to use our vite plugin.
2025-08-29 16:41:16 +02:00
Marvin Hagemeister 111fe8063d fix(vite): use better node -> fetch request polyfill (#3267) 2025-08-27 09:29:24 +02:00
Marvin Hagemeister 280754ee09 fix(vite): update fresh version dependency (#3250) 2025-08-25 15:57:07 +02:00
Marvin Hagemeister d1f7d49466 fix(vite): importing node:* builtins (#3245) 2025-08-22 13:58:39 +02:00
Marvin Hagemeister 5c3fe27046 chore: refactor tests (#3243) 2025-08-22 12:14:19 +02:00
Marvin Hagemeister 27c2910b1d fix(vite): babel transform being applied for non-js files (#3238) 2025-08-21 20:03:00 +02:00
Marvin Hagemeister afdf5eaf6c fix(vite): asset handling (#3225)
This PR reworks asset handling in our vite plugin. Importing assets in
js is now supported.
2025-08-19 16:45:33 +02:00
Marvin Hagemeister 59549c9532 fix(vite): npm resolution + cjs + duplicated preact signals (#3211) 2025-08-16 19:26:39 +02:00
Marvin Hagemeister e05fd10977 chore: release 2.0.0-alpha.58 (#3217) 2025-08-12 12:55:38 +02:00
Marvin Hagemeister 477fcefed4 feat: support inlining FRESH_PUBLIC_ env vars (#3214)
Fixes https://github.com/denoland/fresh/issues/3213
2025-08-12 12:00:59 +02:00
Marvin Hagemeister d026375c3e fix(vite): error when npm package requires json files (#3210) 2025-08-08 14:16:38 +02:00
Marvin Hagemeister 0664476e46 fix: workaround vite treating npm: as built-ins (#3205)
Upstream fix: https://github.com/vitejs/vite/pull/20558
2025-08-08 00:22:54 +02:00
Marvin Hagemeister a084a2c536 fix: unable to load CommonJS in vite plugin (#3204)
Vite has an internal check that limits CommonJS detection to only bare
specifier. This doesn't work well together with us resolving npm modules
to absolute file paths.


https://github.com/vitejs/vite/blob/main/packages/vite/src/node/ssr/fetchModule.ts#L46

I've tried re-using our own instance of `@rollup/plugin-commonjs` or
`esbuild` but couldn't get these to work in that setup. The easiest way
seems to be to just write our own CJS -> ESM translation layer.

With a little luck since the Deno ecosystem is heavy into ESM we might
get away with this. In either way this removes one of the two blockers
to using the vite plugin.
2025-08-08 00:04:16 +02:00
Marvin Hagemeister 815b1940e3 chore: restructure repository into packages/ folder (#3197)
We're having a growing number of packages in this repository. This PR
moves them into a `packages/` directory like it's commonly done in other
projects.
2025-08-06 15:52:45 +02:00
Marvin Hagemeister f35338b75f chore: release 2.0.0-alpha.56 (#3195) 2025-08-06 13:01:02 +02:00
Marvin Hagemeister 83036d87ee fix: extract build-id into seperate package to fix publishing (#3194)
Also makes it easier to replace during bundling.
2025-08-06 12:53:50 +02:00
Marvin Hagemeister 36aa9b5639 feat: add vite plugin (#3187)
Second attempt after we had to revert
https://github.com/denoland/fresh/pull/3185
2025-08-06 12:13:22 +02:00
Marvin Hagemeister a6a16dbd18 fix: unable to load json inside npm packages (#3191) 2025-08-05 16:00:58 +02:00
Marvin Hagemeister 2f76a0a2aa Revert "feat: Add experimental vite plugin (#3184)" (#3185)
This reverts commit a1571b76ed.

It broke fresh.deno.dev :S
2025-08-04 18:54:04 +02:00
Marvin Hagemeister a1571b76ed feat: Add experimental vite plugin (#3184)
This PR adds a vite plugin for Fresh. This enables:

- HMR (only for islands for now)
- self-contained output bundles for both server and client
- smarter chunking

It uses vite's new Environment API under the hood.
2025-08-04 18:30:05 +02:00
Marvin Hagemeister 03f6981860 fix: serialized compute signals re-created as normal signals (#3183)
Fixes https://github.com/denoland/fresh/issues/3182
2025-08-03 20:31:36 +02:00