Skip to content

Commit

Permalink
Merge branch 'master' into v2
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Oct 10, 2023
2 parents 89ab5bf + a09d2fb commit 0e0efa1
Show file tree
Hide file tree
Showing 16 changed files with 26 additions and 67 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ Any BREAKING CHANGE between minor versions will be documented here in upper case
### Added
- The second argument of the `page.data.url()` function has the default URL value.

### Changed
- Removed schema.org meta tags in metas plugin, because they are are not valid.
Probably it needs a new specific plugin.

### Fixed
- Ignore error checking Lume version in offline environments [#496].
- Updated dependencies: `deno_dom`, `katex`, `preact`, `sass`, `svg2png`, `terser`.

## [1.19.1] - 2023-09-29
### Added
- `modify_urls` plugin: The replace callback can return a `Promise<string>`.
Expand Down Expand Up @@ -2442,6 +2450,7 @@ The first version.
[#488]: https://github.com/lumeland/lume/issues/488
[#490]: https://github.com/lumeland/lume/issues/490
[#492]: https://github.com/lumeland/lume/issues/492
[#496]: https://github.com/lumeland/lume/issues/496
[1.19.2]: https://github.com/lumeland/lume/compare/v1.19.1...HEAD
[1.19.1]: https://github.com/lumeland/lume/compare/v1.19.0...v1.19.1
Expand Down
1 change: 1 addition & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- Removed `site.cacheFile()`
- Removed `Entry.setContent()`
- Replace `fn-date` with `Temporal` polyfill to convert dates.
- Removed message to upgrade Lume.

## `search` Plugin

Expand Down
4 changes: 1 addition & 3 deletions cli/build.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { checkUpgrade, log } from "../core/utils.ts";
import { log } from "../core/utils.ts";
import Server from "../core/server.ts";
import FSWatcher, { SiteWatcher } from "../core/watcher.ts";
import { printError } from "../core/errors.ts";
Expand Down Expand Up @@ -43,8 +43,6 @@ export async function build(
` <dim>${total} files generated in ${duration.toFixed(2)} seconds</dim>`,
);

await checkUpgrade();

if (!serve && !watch) {
// Prevent possible timers to keep the process alive forever (wait preventively 10 seconds)
const id = setTimeout(() => {
Expand Down
35 changes: 0 additions & 35 deletions core/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,41 +81,6 @@ export function checkDenoVersion(): void {
}
}

/** Check if the current version is outdated */
export async function checkUpgrade(): Promise<void> {
const current = getLumeVersion();

// It's a local version
if (current.startsWith("local ")) {
return;
}

const stable = !!current.match(/^v\d+\./);
const expires = 1000 * 60 * 60 * 24; // 1 day
const interval = localStorage.getItem("lume-upgrade");

if (interval && parseInt(interval) + expires > Date.now()) {
return;
}

localStorage.setItem("lume-upgrade", Date.now().toString());

const latest = stable
? await getLatestVersion()
: await getLatestDevelopmentVersion();

if (current === latest) {
return;
}

const command = "deno task lume upgrade" + (stable ? "" : " --dev");

console.log("----------------------------------------");
console.log(`Update available ${dim(current)}${green(latest)}`);
console.log(`Run ${cyan(command)} to update`);
console.log("----------------------------------------");
}

/** Return the latest stable version from the deno.land/x repository */
export async function getLatestVersion(): Promise<string> {
const response = await fetch("https://cdn.deno.land/lume/meta/versions.json");
Expand Down
2 changes: 1 addition & 1 deletion deps/dom.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "https://deno.land/x/[email protected].40/deno-dom-wasm.ts";
export * from "https://deno.land/x/[email protected].41-alpha-artifacts/deno-dom-wasm.ts";
2 changes: 1 addition & 1 deletion deps/katex.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import katex from "npm:[email protected].8";
import katex from "npm:[email protected].9";

export { katex };

Expand Down
6 changes: 3 additions & 3 deletions deps/preact.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * as preact from "npm:[email protected].0";
export * as hooks from "npm:[email protected].0/hooks";
export { renderToString } from "npm:[email protected].1";
export * as preact from "npm:[email protected].1";
export * as hooks from "npm:[email protected].1/hooks";
export { renderToString } from "npm:[email protected].2";
2 changes: 1 addition & 1 deletion deps/sass.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "npm:sass@1.68.0";
export * from "npm:sass@1.69.0";
4 changes: 2 additions & 2 deletions deps/svg2png.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { initialize, svg2png } from "npm:[email protected].0";
import { initialize, svg2png } from "npm:[email protected].1";
import { read } from "../core/utils.ts";

// Initialize the WASM module
const url = "https://unpkg.com/[email protected].0/svg2png_wasm_bg.wasm";
const url = "https://unpkg.com/[email protected].1/svg2png_wasm_bg.wasm";
const wasm = await read(url, true);
await initialize(wasm);

Expand Down
4 changes: 2 additions & 2 deletions deps/terser.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { minify } from "npm:terser@5.20.0";
export type { MinifyOptions } from "npm:terser@5.20.0";
export { minify } from "npm:terser@5.21.0";
export type { MinifyOptions } from "npm:terser@5.21.0";
4 changes: 2 additions & 2 deletions plugins/feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export interface FeedItem {

const defaultGenerator = `Lume ${getLumeVersion()}`;

export default (userOptions?: DeepPartial<Options>) => {
export default function (userOptions?: DeepPartial<Options>) {
const options = merge(defaults, userOptions);

return (site: Site) => {
Expand Down Expand Up @@ -185,7 +185,7 @@ export default (userOptions?: DeepPartial<Options>) => {
}
});
};
};
}

function fixUrls(base: URL, html: string): string {
return html.replaceAll(
Expand Down
5 changes: 0 additions & 5 deletions plugins/metas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@ export default function (userOptions?: Partial<Options>): Plugin {
);
addMeta(document, "name", "twitter:site", twitter);

// Schema.org
addMeta(document, "itemprop", "name", title);
addMeta(document, "itemprop", "description", description, 155);
addMeta(document, "itemprop", "image", image || icon);

// SEO
addMeta(document, "name", "description", description, 155);
addMeta(document, "name", "keywords", keywords?.join(", "));
Expand Down
9 changes: 0 additions & 9 deletions tests/__snapshots__/metas.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ snapshot[`metas plugin 3`] = `
<meta property="og:image" content="http://localhost/my-image.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@myUser">
<meta itemprop="name" content="Custom title">
<meta itemprop="description" content="A very long custom description with a lot of text that will be truncated to a maximum of 155 characters and then append &quot;&quot; to the end. Lorem ipsum dolor…">
<meta itemprop="image" content="http://localhost/my-image.png">
<meta name="description" content="A very long custom description with a lot of text that will be truncated to a maximum of 155 characters and then append &quot;&quot; to the end. Lorem ipsum dolor…">
<meta name="keywords" content="one, two">
<meta name="robots" content="index, follow">
Expand Down Expand Up @@ -195,9 +192,6 @@ snapshot[`metas plugin 3`] = `
<meta property="og:image" content="http://localhost/page-2/my-image.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@myUser">
<meta itemprop="name" content="Relative paths">
<meta itemprop="description" content="Tests the use of relative path (to page.data.url) when filling out the og:image or og:icon URL">
<meta itemprop="image" content="http://localhost/page-2/my-image.png">
<meta name="description" content="Tests the use of relative path (to page.data.url) when filling out the og:image or og:icon URL">
<meta name="keywords" content="one, two">
<meta name="robots" content="noindex, nofollow, noarchive">
Expand Down Expand Up @@ -272,9 +266,6 @@ snapshot[`metas plugin 3`] = `
<meta property="og:image" content="http://localhost/page-3/use-cover-as-meta-image.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@myUser">
<meta itemprop="name" content="Title from page data">
<meta itemprop="description" content="This is page excerpt will be used as meta description.">
<meta itemprop="image" content="http://localhost/page-3/use-cover-as-meta-image.png">
<meta name="description" content="This is page excerpt will be used as meta description.">
<meta name="keywords" content="one, two">
<meta name="robots" content="this robots will be overrided">
Expand Down
2 changes: 1 addition & 1 deletion tests/assets/mdx/_components/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @jsxImportSource https://esm.sh/preact */
/** @jsxImportSource npm:preact */

export default function Header({ title, description }) {
return (
Expand Down
2 changes: 1 addition & 1 deletion tests/assets/mdx/_includes/Image.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @jsxImportSource https://esm.sh/preact */
/** @jsxImportSource npm:preact */

interface Options {
src: string;
Expand Down
2 changes: 1 addition & 1 deletion tests/mdx.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Deno.test("Build a mdx site", async (t) => {

site.use(jsx());
site.use(mdx({
pragma: "/** @jsxImportSource https://esm.sh/preact */",
pragma: "/** @jsxImportSource npm:preact */",
}));

await build(site);
Expand Down

0 comments on commit 0e0efa1

Please sign in to comment.