Skip to content

Commit

Permalink
fix: update dependency recommendations (#2320)
Browse files Browse the repository at this point in the history
closes #2319

The issue is because `imports.ts` wasn't changed before releasing. I
thought I would go through and bump some other versions as well. This
handles everything except the esbuild stuff and `tests/`.
  • Loading branch information
deer authored Feb 19, 2024
1 parent bf0e33e commit 82c75f8
Show file tree
Hide file tree
Showing 69 changed files with 198 additions and 186 deletions.
10 changes: 5 additions & 5 deletions .vscode/import_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"$fresh/": "../",
"twind": "https://esm.sh/[email protected]",
"twind/": "https://esm.sh/[email protected]/",
"preact": "https://esm.sh/preact@10.18.1",
"preact/": "https://esm.sh/preact@10.18.1/",
"@preact/signals": "https://esm.sh/*@preact/[email protected].1",
"@preact/signals-core": "https://esm.sh/@preact/[email protected].0",
"preact": "https://esm.sh/preact@10.19.5",
"preact/": "https://esm.sh/preact@10.19.5/",
"@preact/signals": "https://esm.sh/*@preact/[email protected].2",
"@preact/signals-core": "https://esm.sh/@preact/[email protected].1",
"@preact/[email protected]": "https://esm.sh/@preact/[email protected]",
"@preact/[email protected]": "https://esm.sh/@preact/[email protected]",
"$std/": "https://deno.land/std@0.211.0/",
"$std/": "https://deno.land/std@0.216.0/",
"$ga4": "https://raw.githubusercontent.com/denoland/ga4/main/mod.ts",
"$marked-mangle": "https://esm.sh/[email protected]",
"$fresh-testing-library": "https://deno.land/x/[email protected]/mod.ts",
Expand Down
8 changes: 4 additions & 4 deletions demo/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
},
"imports": {
"$fresh/": "../",
"preact": "https://esm.sh/preact@10.15.1",
"preact/": "https://esm.sh/preact@10.15.1/",
"@preact/signals": "https://esm.sh/*@preact/signals@1.1.3",
"@preact/signals-core": "https://esm.sh/@preact/signals-core@1.2.3"
"preact": "https://esm.sh/preact@10.19.5",
"preact/": "https://esm.sh/preact@10.19.5/",
"@preact/signals": "https://esm.sh/*@preact/signals@1.2.2",
"@preact/signals-core": "https://esm.sh/@preact/signals-core@1.5.1"
},
"compilerOptions": {
"jsx": "react-jsx",
Expand Down
4 changes: 2 additions & 2 deletions docs/latest/examples/migrating-to-tailwind.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ export default {
+ "nodeModulesDir": true,
"imports": {
"$fresh/": "https://deno.land/x/[email protected]/",
"preact": "https://esm.sh/[email protected].2",
"preact/": "https://esm.sh/[email protected].2/",
"preact": "https://esm.sh/[email protected].5",
"preact/": "https://esm.sh/[email protected].5/",
- "twind": "https://esm.sh/[email protected]",
- "twind/": "https://esm.sh/[email protected]/",
+ "tailwindcss": "npm:[email protected]",
Expand Down
8 changes: 4 additions & 4 deletions docs/latest/examples/using-fresh-canary-version.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ instead this one particular commit? Just make the following changes to your
"imports": {
- "$fresh/": "https://deno.land/x/[email protected]/",
+ "$fresh/": "https://raw.githubusercontent.com/denoland/fresh/the-particular-commit-hash-here/",
"preact": "https://esm.sh/preact@10.15.1",
"preact/": "https://esm.sh/preact@10.15.1/",
"preact": "https://esm.sh/preact@10.19.5",
"preact/": "https://esm.sh/preact@10.19.5/",
```

### Forked Fresh
Expand All @@ -39,8 +39,8 @@ been merged yet (at the time of writing this):
"imports": {
- "$fresh/": "https://deno.land/x/[email protected]/",
+ "$fresh/": "https://raw.githubusercontent.com/deer/fresh/state_in_props/",
"preact": "https://esm.sh/preact@10.15.1",
"preact/": "https://esm.sh/preact@10.15.1/",
"preact": "https://esm.sh/preact@10.19.5",
"preact/": "https://esm.sh/preact@10.19.5/",
```

## Creating a new project
Expand Down
6 changes: 3 additions & 3 deletions plugins/tailwind.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Plugin, PluginMiddleware, ResolvedFreshConfig } from "../server.ts";
import type postcss from "npm:[email protected].33";
import * as path from "https://deno.land/std@0.207.0/path/mod.ts";
import { walk } from "https://deno.land/std@0.207.0/fs/walk.ts";
import type postcss from "npm:[email protected].35";
import * as path from "https://deno.land/std@0.216.0/path/mod.ts";
import { walk } from "https://deno.land/std@0.216.0/fs/walk.ts";
import { TailwindPluginOptions } from "./tailwind/types.ts";

async function initTailwind(
Expand Down
4 changes: 2 additions & 2 deletions plugins/tailwind/compiler.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ResolvedFreshConfig } from "../../server.ts";
import tailwindCss, { Config } from "tailwindcss";
import postcss from "npm:[email protected].33";
import postcss from "npm:[email protected].35";
import cssnano from "npm:[email protected]";
import autoprefixer from "npm:[email protected]";
import * as path from "https://deno.land/std@0.207.0/path/mod.ts";
import * as path from "https://deno.land/std@0.216.0/path/mod.ts";
import { TailwindPluginOptions } from "./types.ts";

const CONFIG_EXTENSIONS = ["ts", "js", "mjs"];
Expand Down
6 changes: 3 additions & 3 deletions src/build/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export {
join,
relative,
toFileUrl,
} from "https://deno.land/std@0.211.0/path/mod.ts";
export { escape as regexpEscape } from "https://deno.land/std@0.211.0/regexp/escape.ts";
} from "https://deno.land/std@0.216.0/path/mod.ts";
export { escape as regexpEscape } from "https://deno.land/std@0.216.0/regexp/escape.ts";
export { denoPlugins } from "https://deno.land/x/[email protected]/mod.ts";
export { assertEquals } from "https://deno.land/std@0.211.0/assert/mod.ts";
export { assertEquals } from "https://deno.land/std@0.216.0/assert/mod.ts";
28 changes: 14 additions & 14 deletions src/dev/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@ export {
join,
relative,
resolve,
SEP,
SEPARATOR,
toFileUrl,
} from "https://deno.land/std@0.211.0/path/mod.ts";
export { normalize } from "https://deno.land/std@0.211.0/path/posix/mod.ts";
export { DAY, WEEK } from "https://deno.land/std@0.211.0/datetime/constants.ts";
export * as colors from "https://deno.land/std@0.211.0/fmt/colors.ts";
} from "https://deno.land/std@0.216.0/path/mod.ts";
export { normalize } from "https://deno.land/std@0.216.0/path/posix/mod.ts";
export { DAY, WEEK } from "https://deno.land/std@0.216.0/datetime/constants.ts";
export * as colors from "https://deno.land/std@0.216.0/fmt/colors.ts";
export {
walk,
type WalkEntry,
WalkError,
} from "https://deno.land/std@0.211.0/fs/walk.ts";
export { parse } from "https://deno.land/std@0.211.0/flags/mod.ts";
} from "https://deno.land/std@0.216.0/fs/walk.ts";
export { parse } from "https://deno.land/std@0.216.0/flags/mod.ts";
export {
gte,
lt,
greaterOrEqual,
lessThan,
parse as semverParse,
} from "https://deno.land/std@0.211.0/semver/mod.ts";
export { emptyDir, existsSync } from "https://deno.land/std@0.211.0/fs/mod.ts";
export * as JSONC from "https://deno.land/std@0.211.0/jsonc/mod.ts";
export { assertEquals } from "https://deno.land/std@0.211.0/assert/mod.ts";
} from "https://deno.land/std@0.216.0/semver/mod.ts";
export { emptyDir, existsSync } from "https://deno.land/std@0.216.0/fs/mod.ts";
export * as JSONC from "https://deno.land/std@0.216.0/jsonc/mod.ts";
export { assertEquals } from "https://deno.land/std@0.216.0/assert/mod.ts";

// ts-morph
export { Node, Project } from "https://deno.land/x/ts_morph@20.0.0/mod.ts";
export { Node, Project } from "https://deno.land/x/ts_morph@21.0.1/mod.ts";
8 changes: 4 additions & 4 deletions src/dev/imports.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export const RECOMMENDED_PREACT_VERSION = "10.19.2";
export const RECOMMENDED_PREACT_SIGNALS_VERSION = "1.2.1";
export const RECOMMENDED_PREACT_SIGNALS_CORE_VERSION = "1.5.0";
export const RECOMMENDED_PREACT_VERSION = "10.19.5";
export const RECOMMENDED_PREACT_SIGNALS_VERSION = "1.2.2";
export const RECOMMENDED_PREACT_SIGNALS_CORE_VERSION = "1.5.1";
export const RECOMMENDED_TWIND_CORE_VERSION = "1.1.3";
export const RECOMMENDED_TWIND_PRESET_AUTOPREFIX_VERSION = "1.0.7";
export const RECOMMENDED_TWIND_PRESET_TAILWIND_VERSION = "1.1.4";
export const RECOMMENDED_STD_VERSION = "0.211.0";
export const RECOMMENDED_STD_VERSION = "0.216.0";
export const RECOMMENDED_TAILIWIND_VERSION = "3.4.1";

export function freshImports(imports: Record<string, string>) {
Expand Down
16 changes: 14 additions & 2 deletions src/dev/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { gte, join, relative, semverParse, walk, WalkEntry } from "./deps.ts";
import {
greaterOrEqual,
join,
relative,
semverParse,
walk,
WalkEntry,
} from "./deps.ts";
export { generate, type Manifest } from "./manifest.ts";
import { generate, type Manifest } from "./manifest.ts";
import { error } from "./error.ts";
Expand All @@ -7,7 +14,12 @@ const TEST_FILE_PATTERN = /[._]test\.(?:[tj]sx?|[mc][tj]s)$/;

export function ensureMinDenoVersion() {
// Check that the minimum supported Deno version is being used.
if (!gte(semverParse(Deno.version.deno), semverParse(MIN_DENO_VERSION))) {
if (
!greaterOrEqual(
semverParse(Deno.version.deno),
semverParse(MIN_DENO_VERSION),
)
) {
let message =
`Deno version ${MIN_DENO_VERSION} or higher is required. Please update Deno.\n\n`;

Expand Down
4 changes: 2 additions & 2 deletions src/dev/update_check.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { colors, join, lt, semverParse } from "./deps.ts";
import { colors, join, lessThan, semverParse } from "./deps.ts";

export interface CheckFile {
last_checked: string;
Expand Down Expand Up @@ -118,7 +118,7 @@ export async function updateCheck(
if (
(!checkFile.last_shown ||
Date.now() >= new Date(checkFile.last_shown).getTime() + interval) &&
lt(currentVersion, latestVersion)
lessThan(currentVersion, latestVersion)
) {
checkFile.last_shown = new Date().toISOString();

Expand Down
4 changes: 2 additions & 2 deletions src/server/compose.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SEP } from "./deps.ts";
import { SEPARATOR } from "./deps.ts";
import { ErrorHandler, FinalHandler, RouteResult, withBase } from "./router.ts";
import {
BaseRoute,
Expand All @@ -10,7 +10,7 @@ import {
export const ROOT_BASE_ROUTE = toBaseRoute("/");

export function toBaseRoute(input: string): BaseRoute {
input = input.replaceAll(SEP, "/");
input = input.replaceAll(SEPARATOR, "/");

if (input.endsWith("_layout")) {
input = input.slice(0, -"_layout".length);
Expand Down
4 changes: 2 additions & 2 deletions src/server/context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { contentType, extname, SEP, STATUS_CODE } from "./deps.ts";
import { contentType, extname, SEPARATOR, STATUS_CODE } from "./deps.ts";
import * as router from "./router.ts";
import { FreshConfig, FreshContext, Manifest } from "./mod.ts";
import {
Expand Down Expand Up @@ -353,7 +353,7 @@ export class ServerContext {
const { localUrl, path, size, contentType, etag } of this.#extractResult
.staticFiles
) {
staticRoutes[path.replaceAll(SEP, "/")] = {
staticRoutes[path.replaceAll(SEPARATOR, "/")] = {
baseRoute: toBaseRoute(path),
methods: {
"HEAD": this.#staticFileHandler(
Expand Down
26 changes: 13 additions & 13 deletions src/server/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@ export {
fromFileUrl,
isAbsolute,
join,
SEP,
SEPARATOR,
toFileUrl,
} from "https://deno.land/std@0.211.0/path/mod.ts";
export { walk } from "https://deno.land/std@0.211.0/fs/walk.ts";
export * as colors from "https://deno.land/std@0.211.0/fmt/colors.ts";
} from "https://deno.land/std@0.216.0/path/mod.ts";
export { walk } from "https://deno.land/std@0.216.0/fs/walk.ts";
export * as colors from "https://deno.land/std@0.216.0/fmt/colors.ts";
export {
type Handler as ServeHandler,
serve,
} from "https://deno.land/std@0.211.0/http/server.ts";
export { STATUS_CODE } from "https://deno.land/std@0.211.0/http/status.ts";
} from "https://deno.land/std@0.216.0/http/server.ts";
export { STATUS_CODE } from "https://deno.land/std@0.216.0/http/status.ts";
export {
contentType,
} from "https://deno.land/std@0.211.0/media_types/content_type.ts";
export { encodeHex } from "https://deno.land/std@0.211.0/encoding/hex.ts";
export { escape } from "https://deno.land/std@0.211.0/regexp/escape.ts";
export * as JSONC from "https://deno.land/std@0.211.0/jsonc/mod.ts";
} from "https://deno.land/std@0.216.0/media_types/content_type.ts";
export { encodeHex } from "https://deno.land/std@0.216.0/encoding/hex.ts";
export { escape } from "https://deno.land/std@0.216.0/regexp/escape.ts";
export * as JSONC from "https://deno.land/std@0.216.0/jsonc/mod.ts";
export { renderToString } from "https://esm.sh/*[email protected]";
export {
assertEquals,
assertThrows,
} from "https://deno.land/std@0.211.0/assert/mod.ts";
} from "https://deno.land/std@0.216.0/assert/mod.ts";
export {
isIdentifierChar,
isIdentifierStart,
} from "https://esm.sh/@babel/[email protected]";
export { normalize } from "https://deno.land/std@0.211.0/path/posix/mod.ts";
export { assertSnapshot } from "https://deno.land/std@0.211.0/testing/snapshot.ts";
export { normalize } from "https://deno.land/std@0.216.0/path/posix/mod.ts";
export { assertSnapshot } from "https://deno.land/std@0.216.0/testing/snapshot.ts";
4 changes: 2 additions & 2 deletions src/server/fs_extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
dirname,
extname,
join,
SEP,
SEPARATOR,
toFileUrl,
walk,
} from "./deps.ts";
Expand Down Expand Up @@ -111,7 +111,7 @@ export async function extractRoutes(
const path = url.substring(baseUrl.length + "routes".length);
let baseRoute = path.substring(1, path.length - extname(path).length);
baseRoute = join(state.config.basePath.slice(1), baseRoute).replaceAll(
SEP,
SEPARATOR,
"/",
);
const name = baseRoute.replace(/\//g, "-");
Expand Down
4 changes: 2 additions & 2 deletions src/server/rendering/preact_hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from "preact";
import { assetHashingHook } from "../../runtime/utils.ts";
import { Partial, PartialProps } from "../../runtime/Partial.tsx";
import { join, renderToString, SEP } from "../deps.ts";
import { join, renderToString, SEPARATOR } from "../deps.ts";
import { RenderState } from "./state.ts";
import { Island } from "../types.ts";
import {
Expand Down Expand Up @@ -238,7 +238,7 @@ options.vnode = (vnode) => {

if (url.startsWith("/") && current?.basePath) {
const joinedPath = join("/", current.basePath, url).replaceAll(
SEP,
SEPARATOR,
"/",
);
out.push(leading + joinedPath + trailing);
Expand Down
26 changes: 13 additions & 13 deletions tests/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ export {
assertRejects,
assertStringIncludes,
assertThrows,
} from "https://deno.land/std@0.211.0/assert/mod.ts";
export { assertSnapshot } from "https://deno.land/std@0.211.0/testing/snapshot.ts";
} from "https://deno.land/std@0.216.0/assert/mod.ts";
export { assertSnapshot } from "https://deno.land/std@0.216.0/testing/snapshot.ts";
export {
TextLineStream,
} from "https://deno.land/std@0.211.0/streams/text_line_stream.ts";
export { delay } from "https://deno.land/std@0.211.0/async/delay.ts";
export { retry } from "https://deno.land/std@0.211.0/async/retry.ts";
} from "https://deno.land/std@0.216.0/streams/text_line_stream.ts";
export { delay } from "https://deno.land/std@0.216.0/async/delay.ts";
export { retry } from "https://deno.land/std@0.216.0/async/retry.ts";
export {
default as puppeteer,
Page,
Expand All @@ -31,21 +31,21 @@ export {
DOMParser,
HTMLElement,
HTMLMetaElement,
} from "https://esm.sh/linkedom@0.15.1";
} from "https://esm.sh/linkedom@0.16.8";
export { defineConfig, type Preset } from "https://esm.sh/@twind/[email protected]";
export { default as presetTailwind } from "https://esm.sh/@twind/[email protected]";
export { copy } from "https://deno.land/std@0.211.0/fs/mod.ts";
export { copy } from "https://deno.land/std@0.216.0/fs/mod.ts";
export {
basename,
dirname,
extname,
fromFileUrl,
join,
relative,
SEP,
SEPARATOR,
toFileUrl,
} from "https://deno.land/std@0.211.0/path/mod.ts";
export * as JSONC from "https://deno.land/std@0.211.0/jsonc/mod.ts";
export * as colors from "https://deno.land/std@0.211.0/fmt/colors.ts";
export { STATUS_CODE } from "https://deno.land/std@0.211.0/http/status.ts";
export { stripAnsiCode } from "https://deno.land/std@0.211.0/fmt/colors.ts";
} from "https://deno.land/std@0.216.0/path/mod.ts";
export * as JSONC from "https://deno.land/std@0.216.0/jsonc/mod.ts";
export * as colors from "https://deno.land/std@0.216.0/fmt/colors.ts";
export { STATUS_CODE } from "https://deno.land/std@0.216.0/http/status.ts";
export { stripAnsiCode } from "https://deno.land/std@0.216.0/fmt/colors.ts";
4 changes: 2 additions & 2 deletions tests/fixture/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"lock": false,
"imports": {
"$fresh/": "../../",
"preact": "https://esm.sh/preact@10.15.1",
"preact/": "https://esm.sh/preact@10.15.1/",
"preact": "https://esm.sh/preact@10.19.5",
"preact/": "https://esm.sh/preact@10.19.5/",
"@preact/signals": "https://esm.sh/*@preact/[email protected]",
"@preact/signals-core": "https://esm.sh/@preact/[email protected]"
},
Expand Down
4 changes: 2 additions & 2 deletions tests/fixture/routes/ctx_config.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { defineRoute } from "$fresh/server.ts";
import { relative, SEP } from "$fresh/tests/deps.ts";
import { relative, SEPARATOR } from "$fresh/tests/deps.ts";

export default defineRoute((_req, ctx) => {
const value = JSON.stringify(ctx, (key, value) => {
if (key === "outDir" || key == "staticDir") {
return relative(Deno.cwd(), value).split(SEP).join("/");
return relative(Deno.cwd(), value).split(SEPARATOR).join("/");
}
if (typeof value === "function") return value.constructor.name;
if (value === undefined) return "<undefined>";
Expand Down
4 changes: 2 additions & 2 deletions tests/fixture/routes/ctx_config_props.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { PageProps } from "$fresh/server.ts";
import { relative, SEP } from "../../deps.ts";
import { relative, SEPARATOR } from "../../deps.ts";

export default function Page(props: PageProps) {
const value = JSON.stringify(props, (key, value) => {
if (key === "outDir" || key == "staticDir") {
return relative(Deno.cwd(), value).split(SEP).join("/");
return relative(Deno.cwd(), value).split(SEPARATOR).join("/");
}
if (typeof value === "function") return value.constructor.name;
if (value === undefined) return "<undefined>";
Expand Down
Loading

0 comments on commit 82c75f8

Please sign in to comment.