astro 4.4.4 → 4.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Code.astro +3 -3
- package/components/ViewTransitions.astro +5 -0
- package/dist/@types/astro.d.ts +2 -2
- package/dist/assets/build/generate.js +1 -1
- package/dist/assets/endpoint/generic.js +1 -1
- package/dist/assets/endpoint/node.js +2 -2
- package/dist/assets/utils/metadata.js +1 -1
- package/dist/assets/utils/transformToPath.js +1 -1
- package/dist/cli/add/index.js +4 -4
- package/dist/cli/check/index.js +1 -1
- package/dist/cli/db/index.js +2 -2
- package/dist/cli/info/index.js +2 -2
- package/dist/cli/install-package.js +2 -2
- package/dist/cli/preferences/index.js +5 -5
- package/dist/content/server-listeners.js +1 -1
- package/dist/content/types-generator.js +2 -2
- package/dist/content/utils.d.ts +1 -1
- package/dist/content/utils.js +2 -2
- package/dist/content/vite-plugin-content-imports.js +1 -1
- package/dist/content/vite-plugin-content-virtual-mod.js +1 -1
- package/dist/core/app/common.d.ts +1 -1
- package/dist/core/app/index.js +10 -10
- package/dist/core/app/node.d.ts +1 -1
- package/dist/core/app/node.js +1 -1
- package/dist/core/app/types.d.ts +2 -2
- package/dist/core/base-pipeline.js +1 -1
- package/dist/core/build/generate.js +11 -11
- package/dist/core/build/index.js +2 -2
- package/dist/core/build/pipeline.js +1 -1
- package/dist/core/build/plugins/plugin-manifest.js +3 -3
- package/dist/core/build/plugins/plugin-ssr.js +1 -1
- package/dist/core/build/plugins/util.d.ts +1 -1
- package/dist/core/build/plugins/util.js +8 -7
- package/dist/core/build/static-build.js +3 -3
- package/dist/core/client-directive/build.js +1 -1
- package/dist/core/compile/compile.js +1 -1
- package/dist/core/config/config.js +1 -1
- package/dist/core/config/settings.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.d.ts +1 -1
- package/dist/core/dev/dev.js +3 -3
- package/dist/core/endpoint/index.d.ts +1 -1
- package/dist/core/endpoint/index.js +2 -2
- package/dist/core/errors/dev/utils.js +2 -2
- package/dist/core/errors/errors-data.js +1 -1
- package/dist/core/logger/vite.d.ts +1 -1
- package/dist/core/logger/vite.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/middleware/index.js +4 -4
- package/dist/core/middleware/loadMiddleware.js +1 -1
- package/dist/core/preview/index.js +2 -2
- package/dist/core/render/result.d.ts +1 -1
- package/dist/core/render/result.js +6 -6
- package/dist/core/render/route-cache.d.ts +1 -0
- package/dist/core/render/route-cache.js +8 -4
- package/dist/core/render-context.d.ts +4 -1
- package/dist/core/render-context.js +53 -33
- package/dist/core/request.d.ts +2 -1
- package/dist/core/request.js +8 -2
- package/dist/core/routing/manifest/create.js +2 -2
- package/dist/core/sync/index.js +3 -3
- package/dist/i18n/middleware.js +1 -1
- package/dist/integrations/index.js +1 -1
- package/dist/jsx-runtime/index.js +1 -1
- package/dist/preferences/store.js +2 -2
- package/dist/runtime/client/dev-toolbar/apps/astro.js +4 -2
- package/dist/runtime/client/dev-toolbar/apps/audit/index.js +3 -25
- package/dist/runtime/client/dev-toolbar/apps/settings.d.ts +1 -1
- package/dist/runtime/client/dev-toolbar/apps/settings.js +3 -2
- package/dist/runtime/client/dev-toolbar/apps/utils/window.d.ts +1 -0
- package/dist/runtime/client/dev-toolbar/apps/utils/window.js +26 -0
- package/dist/runtime/client/dev-toolbar/apps/xray.js +2 -26
- package/dist/runtime/server/escape.js +2 -0
- package/dist/runtime/server/index.js +1 -1
- package/dist/runtime/server/render/astro/render.js +1 -1
- package/dist/runtime/server/render/page.js +1 -1
- package/dist/runtime/server/render/util.js +2 -0
- package/dist/runtime/server/scripts.js +1 -1
- package/dist/runtime/server/transition.js +2 -1
- package/dist/vite-plugin-astro-server/base.js +1 -1
- package/dist/vite-plugin-astro-server/error.d.ts +1 -1
- package/dist/vite-plugin-astro-server/error.js +1 -1
- package/dist/vite-plugin-astro-server/pipeline.d.ts +1 -1
- package/dist/vite-plugin-astro-server/pipeline.js +6 -6
- package/dist/vite-plugin-astro-server/plugin.js +6 -6
- package/dist/vite-plugin-astro-server/request.js +1 -7
- package/dist/vite-plugin-astro-server/route.js +4 -3
- package/dist/vite-plugin-env/index.js +1 -1
- package/dist/vite-plugin-inject-env-ts/index.js +1 -1
- package/dist/vite-plugin-markdown/index.js +5 -5
- package/dist/vite-plugin-scanner/index.js +1 -1
- package/dist/vite-plugin-utils/index.js +1 -1
- package/package.json +1 -1
package/components/Code.astro
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
+
import type { ThemePresets } from '@astrojs/markdown-remark';
|
|
2
3
|
import type {
|
|
3
4
|
BuiltinLanguage,
|
|
4
|
-
BuiltinTheme,
|
|
5
5
|
LanguageRegistration,
|
|
6
6
|
SpecialLanguage,
|
|
7
7
|
ThemeRegistration,
|
|
@@ -28,12 +28,12 @@ interface Props {
|
|
|
28
28
|
*
|
|
29
29
|
* @default "github-dark"
|
|
30
30
|
*/
|
|
31
|
-
theme?:
|
|
31
|
+
theme?: ThemePresets | ThemeRegistration | ThemeRegistrationRaw;
|
|
32
32
|
/**
|
|
33
33
|
* Multiple themes to style with -- alternative to "theme" option.
|
|
34
34
|
* Supports all themes found above; see https://github.com/antfu/shikiji#lightdark-dual-themes for more information.
|
|
35
35
|
*/
|
|
36
|
-
experimentalThemes?: Record<string,
|
|
36
|
+
experimentalThemes?: Record<string, ThemePresets | ThemeRegistration | ThemeRegistrationRaw>;
|
|
37
37
|
/**
|
|
38
38
|
* Enable word wrapping.
|
|
39
39
|
* - true: enabled.
|
|
@@ -51,6 +51,11 @@ const { fallback = 'animate' } = Astro.props;
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
if (supportsViewTransitions || getFallback() !== 'none') {
|
|
54
|
+
if (import.meta.env.DEV && window.matchMedia('(prefers-reduced-motion)').matches) {
|
|
55
|
+
console.warn(
|
|
56
|
+
`[transitions]: all view transition animations, including fallback animation, are disabled as this device has the prefer-reduced-motion setting enabled.`
|
|
57
|
+
);
|
|
58
|
+
}
|
|
54
59
|
document.addEventListener('click', (ev) => {
|
|
55
60
|
let link = ev.target;
|
|
56
61
|
if (ev.composed) {
|
package/dist/@types/astro.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
import type { MarkdownHeading, MarkdownMetadata, MarkdownRenderingResult, RehypePlugins, RemarkPlugins, RemarkRehype, ShikiConfig } from '@astrojs/markdown-remark';
|
|
4
|
-
import type * as babel from '@babel/core';
|
|
5
3
|
import type { OutgoingHttpHeaders } from 'node:http';
|
|
6
4
|
import type { AddressInfo } from 'node:net';
|
|
5
|
+
import type { MarkdownHeading, MarkdownMetadata, MarkdownRenderingResult, RehypePlugins, RemarkPlugins, RemarkRehype, ShikiConfig } from '@astrojs/markdown-remark';
|
|
6
|
+
import type * as babel from '@babel/core';
|
|
7
7
|
import type * as rollup from 'rollup';
|
|
8
8
|
import type * as vite from 'vite';
|
|
9
9
|
import type { RemotePattern } from '../assets/utils/remotePattern.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { dim, green } from "kleur/colors";
|
|
2
1
|
import fs, { readFileSync } from "node:fs";
|
|
3
2
|
import { basename, join } from "node:path/posix";
|
|
3
|
+
import { dim, green } from "kleur/colors";
|
|
4
4
|
import { getOutDirWithinCwd } from "../../core/build/common.js";
|
|
5
5
|
import { getTimeStat } from "../../core/build/util.js";
|
|
6
6
|
import { AstroError } from "../../core/errors/errors.js";
|
|
@@ -2,8 +2,8 @@ import { isRemotePath } from "@astrojs/internal-helpers/path";
|
|
|
2
2
|
import mime from "mime/lite.js";
|
|
3
3
|
import { getConfiguredImageService } from "../internal.js";
|
|
4
4
|
import { etag } from "../utils/etag.js";
|
|
5
|
-
import { imageConfig } from "astro:assets";
|
|
6
5
|
import { isRemoteAllowed } from "../utils/remotePattern.js";
|
|
6
|
+
import { imageConfig } from "astro:assets";
|
|
7
7
|
async function loadRemoteImage(src) {
|
|
8
8
|
try {
|
|
9
9
|
const res = await fetch(src);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import os from "os";
|
|
1
2
|
import { isRemotePath, removeQueryString } from "@astrojs/internal-helpers/path";
|
|
2
3
|
import { readFile } from "fs/promises";
|
|
3
4
|
import mime from "mime/lite.js";
|
|
4
|
-
import os from "os";
|
|
5
5
|
import { getConfiguredImageService } from "../internal.js";
|
|
6
6
|
import { etag } from "../utils/etag.js";
|
|
7
|
-
import { assetsDir, imageConfig } from "astro:assets";
|
|
8
7
|
import { isRemoteAllowed } from "../utils/remotePattern.js";
|
|
8
|
+
import { assetsDir, imageConfig } from "astro:assets";
|
|
9
9
|
function replaceFileSystemReferences(src) {
|
|
10
10
|
return os.platform().includes("win32") ? src.replace(/^\/@fs\//, "") : src.replace(/^\/@fs/, "");
|
|
11
11
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { lookup as probe } from "../utils/vendor/image-size/lookup.js";
|
|
2
1
|
import { AstroError, AstroErrorData } from "../../core/errors/index.js";
|
|
2
|
+
import { lookup as probe } from "../utils/vendor/image-size/lookup.js";
|
|
3
3
|
async function imageMetadata(data, src) {
|
|
4
4
|
const result = probe(data);
|
|
5
5
|
if (!result.height || !result.width || !result.type) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { deterministicString } from "deterministic-object-hash";
|
|
2
1
|
import { basename, extname } from "node:path";
|
|
2
|
+
import { deterministicString } from "deterministic-object-hash";
|
|
3
3
|
import { removeQueryString } from "../../core/path.js";
|
|
4
4
|
import { shorthash } from "../../runtime/server/shorthash.js";
|
|
5
5
|
import { isESMImportedImage } from "./imageKind.js";
|
package/dist/cli/add/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import fsMod, { existsSync, promises as fs } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
1
4
|
import boxen from "boxen";
|
|
2
5
|
import { diffWords } from "diff";
|
|
3
6
|
import { execa } from "execa";
|
|
4
7
|
import { bold, cyan, dim, green, magenta, red, yellow } from "kleur/colors";
|
|
5
|
-
import fsMod, { existsSync, promises as fs } from "node:fs";
|
|
6
|
-
import path from "node:path";
|
|
7
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
8
|
-
import maxSatisfying from "semver/ranges/max-satisfying.js";
|
|
9
8
|
import ora from "ora";
|
|
10
9
|
import preferredPM from "preferred-pm";
|
|
11
10
|
import prompts from "prompts";
|
|
11
|
+
import maxSatisfying from "semver/ranges/max-satisfying.js";
|
|
12
12
|
import {
|
|
13
13
|
loadTSConfig,
|
|
14
14
|
resolveConfig,
|
package/dist/cli/check/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import { ensureProcessNodeEnv } from "../../core/util.js";
|
|
2
3
|
import { createLoggerFromFlags, flagsToAstroInlineConfig } from "../flags.js";
|
|
3
4
|
import { getPackage } from "../install-package.js";
|
|
4
|
-
import { ensureProcessNodeEnv } from "../../core/util.js";
|
|
5
5
|
async function check(flags) {
|
|
6
6
|
ensureProcessNodeEnv("production");
|
|
7
7
|
const logger = createLoggerFromFlags(flags);
|
package/dist/cli/db/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createLoggerFromFlags, flagsToAstroInlineConfig } from "../flags.js";
|
|
2
|
-
import { getPackage } from "../install-package.js";
|
|
3
1
|
import { resolveConfig } from "../../core/config/config.js";
|
|
4
2
|
import { apply as applyPolyfill } from "../../core/polyfill.js";
|
|
3
|
+
import { createLoggerFromFlags, flagsToAstroInlineConfig } from "../flags.js";
|
|
4
|
+
import { getPackage } from "../install-package.js";
|
|
5
5
|
async function db({ flags }) {
|
|
6
6
|
applyPolyfill();
|
|
7
7
|
const logger = createLoggerFromFlags(flags);
|
package/dist/cli/info/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as colors from "kleur/colors";
|
|
2
1
|
import { execSync } from "node:child_process";
|
|
3
2
|
import { arch, platform } from "node:os";
|
|
3
|
+
import * as colors from "kleur/colors";
|
|
4
4
|
import prompts from "prompts";
|
|
5
5
|
import { resolveConfig } from "../../core/config/index.js";
|
|
6
6
|
import { ASTRO_VERSION } from "../../core/constants.js";
|
|
7
|
-
import { flagsToAstroInlineConfig } from "../flags.js";
|
|
8
7
|
import { apply as applyPolyfill } from "../../core/polyfill.js";
|
|
8
|
+
import { flagsToAstroInlineConfig } from "../flags.js";
|
|
9
9
|
async function getInfoOutput({
|
|
10
10
|
userConfig,
|
|
11
11
|
print
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { sep } from "node:path";
|
|
1
3
|
import boxen from "boxen";
|
|
2
4
|
import { execa } from "execa";
|
|
3
5
|
import { bold, cyan, dim, magenta } from "kleur/colors";
|
|
@@ -6,8 +8,6 @@ import prompts from "prompts";
|
|
|
6
8
|
import resolvePackage from "resolve";
|
|
7
9
|
import whichPm from "which-pm";
|
|
8
10
|
import {} from "../core/logger/core.js";
|
|
9
|
-
import { createRequire } from "node:module";
|
|
10
|
-
import { sep } from "node:path";
|
|
11
11
|
const require2 = createRequire(import.meta.url);
|
|
12
12
|
async function getPackage(packageName, logger, options, otherDeps = []) {
|
|
13
13
|
try {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { bgGreen, black, bold, dim, yellow } from "kleur/colors";
|
|
2
1
|
import { fileURLToPath } from "node:url";
|
|
2
|
+
import { bgGreen, black, bold, dim, yellow } from "kleur/colors";
|
|
3
|
+
import { formatWithOptions } from "node:util";
|
|
3
4
|
import dlv from "dlv";
|
|
5
|
+
import { flattie } from "flattie";
|
|
4
6
|
import { resolveConfig } from "../../core/config/config.js";
|
|
5
7
|
import { createSettings } from "../../core/config/settings.js";
|
|
8
|
+
import { collectErrorMetadata } from "../../core/errors/dev/utils.js";
|
|
6
9
|
import * as msg from "../../core/messages.js";
|
|
10
|
+
import { apply as applyPolyfill } from "../../core/polyfill.js";
|
|
7
11
|
import { DEFAULT_PREFERENCES } from "../../preferences/defaults.js";
|
|
8
12
|
import { coerce, isValidKey } from "../../preferences/index.js";
|
|
9
13
|
import { createLoggerFromFlags, flagsToAstroInlineConfig } from "../flags.js";
|
|
10
|
-
import { flattie } from "flattie";
|
|
11
|
-
import { formatWithOptions } from "node:util";
|
|
12
|
-
import { collectErrorMetadata } from "../../core/errors/dev/utils.js";
|
|
13
|
-
import { apply as applyPolyfill } from "../../core/polyfill.js";
|
|
14
14
|
const PREFERENCES_SUBCOMMANDS = [
|
|
15
15
|
"get",
|
|
16
16
|
"set",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { bold, cyan, underline } from "kleur/colors";
|
|
2
1
|
import path from "node:path";
|
|
3
2
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
3
|
+
import { bold, cyan, underline } from "kleur/colors";
|
|
4
4
|
import { loadTSConfig } from "../core/config/tsconfig.js";
|
|
5
5
|
import { appendForwardSlash } from "../core/path.js";
|
|
6
6
|
import { createContentTypesGenerator } from "./types-generator.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import glob from "fast-glob";
|
|
2
|
-
import { bold, cyan } from "kleur/colors";
|
|
3
1
|
import * as path from "node:path";
|
|
4
2
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
3
|
+
import glob from "fast-glob";
|
|
4
|
+
import { bold, cyan } from "kleur/colors";
|
|
5
5
|
import { normalizePath } from "vite";
|
|
6
6
|
import { AstroError } from "../core/errors/errors.js";
|
|
7
7
|
import { AstroErrorData } from "../core/errors/index.js";
|
package/dist/content/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import matter from 'gray-matter';
|
|
3
2
|
import fsMod from 'node:fs';
|
|
3
|
+
import matter from 'gray-matter';
|
|
4
4
|
import type { PluginContext } from 'rollup';
|
|
5
5
|
import { type ViteDevServer } from 'vite';
|
|
6
6
|
import { z } from 'zod';
|
package/dist/content/utils.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { slug as githubSlug } from "github-slugger";
|
|
2
|
-
import matter from "gray-matter";
|
|
3
1
|
import fsMod from "node:fs";
|
|
4
2
|
import path from "node:path";
|
|
5
3
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
|
+
import { slug as githubSlug } from "github-slugger";
|
|
5
|
+
import matter from "gray-matter";
|
|
6
6
|
import { normalizePath } from "vite";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { AstroError, AstroErrorData } from "../core/errors/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as devalue from "devalue";
|
|
2
1
|
import { extname } from "node:path";
|
|
3
2
|
import { pathToFileURL } from "node:url";
|
|
3
|
+
import * as devalue from "devalue";
|
|
4
4
|
import { getProxyCode } from "../assets/utils/proxy.js";
|
|
5
5
|
import { AstroError } from "../core/errors/errors.js";
|
|
6
6
|
import { AstroErrorData } from "../core/errors/index.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import glob from "fast-glob";
|
|
2
1
|
import nodeFs from "node:fs";
|
|
3
2
|
import { extname } from "node:path";
|
|
4
3
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
|
+
import glob from "fast-glob";
|
|
5
5
|
import pLimit from "p-limit";
|
|
6
6
|
import {} from "vite";
|
|
7
7
|
import { encodeName } from "../core/build/util.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SSRManifest, SerializedSSRManifest } from './types.js';
|
|
2
2
|
export declare function deserializeManifest(serializedManifest: SerializedSSRManifest): SSRManifest;
|
package/dist/core/app/index.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
+
import { normalizeTheLocale } from "../../i18n/index.js";
|
|
2
|
+
import {
|
|
3
|
+
REROUTABLE_STATUS_CODES,
|
|
4
|
+
REROUTE_DIRECTIVE_HEADER,
|
|
5
|
+
clientAddressSymbol,
|
|
6
|
+
clientLocalsSymbol,
|
|
7
|
+
responseSentSymbol
|
|
8
|
+
} from "../constants.js";
|
|
1
9
|
import { getSetCookiesFromResponse } from "../cookies/index.js";
|
|
10
|
+
import { AstroError, AstroErrorData } from "../errors/index.js";
|
|
2
11
|
import { consoleLogDestination } from "../logger/console.js";
|
|
3
12
|
import { AstroIntegrationLogger, Logger } from "../logger/core.js";
|
|
4
13
|
import {
|
|
@@ -9,19 +18,10 @@ import {
|
|
|
9
18
|
removeTrailingForwardSlash
|
|
10
19
|
} from "../path.js";
|
|
11
20
|
import { RedirectSinglePageBuiltModule } from "../redirects/index.js";
|
|
21
|
+
import { RenderContext } from "../render-context.js";
|
|
12
22
|
import { createAssetLink } from "../render/ssr-element.js";
|
|
13
23
|
import { matchRoute } from "../routing/match.js";
|
|
14
24
|
import { AppPipeline } from "./pipeline.js";
|
|
15
|
-
import { normalizeTheLocale } from "../../i18n/index.js";
|
|
16
|
-
import { RenderContext } from "../render-context.js";
|
|
17
|
-
import {
|
|
18
|
-
clientAddressSymbol,
|
|
19
|
-
clientLocalsSymbol,
|
|
20
|
-
responseSentSymbol,
|
|
21
|
-
REROUTABLE_STATUS_CODES,
|
|
22
|
-
REROUTE_DIRECTIVE_HEADER
|
|
23
|
-
} from "../constants.js";
|
|
24
|
-
import { AstroError, AstroErrorData } from "../errors/index.js";
|
|
25
25
|
import { deserializeManifest } from "./common.js";
|
|
26
26
|
class App {
|
|
27
27
|
#manifest;
|
package/dist/core/app/node.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import { App } from './index.js';
|
|
3
2
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
4
3
|
import type { RouteData } from '../../@types/astro.js';
|
|
4
|
+
import { App } from './index.js';
|
|
5
5
|
import type { RenderOptions } from './index.js';
|
|
6
6
|
import type { SSRManifest } from './types.js';
|
|
7
7
|
export { apply as applyPolyfills } from '../polyfill.js';
|
package/dist/core/app/node.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
-
import { App } from "./index.js";
|
|
3
2
|
import { deserializeManifest } from "./common.js";
|
|
4
3
|
import { createOutgoingHttpHeaders } from "./createOutgoingHttpHeaders.js";
|
|
4
|
+
import { App } from "./index.js";
|
|
5
5
|
import { apply } from "../polyfill.js";
|
|
6
6
|
const clientAddressSymbol = Symbol.for("astro.clientAddress");
|
|
7
7
|
class NodeApp extends App {
|
package/dist/core/app/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Locales, MiddlewareHandler, RouteData,
|
|
2
|
-
import type { SinglePageBuiltModule } from '../build/types.js';
|
|
1
|
+
import type { Locales, MiddlewareHandler, RouteData, SSRComponentMetadata, SSRLoadedRenderer, SSRResult, SerializedRouteData } from '../../@types/astro.js';
|
|
3
2
|
import type { RoutingStrategies } from '../../i18n/utils.js';
|
|
3
|
+
import type { SinglePageBuiltModule } from '../build/types.js';
|
|
4
4
|
export type ComponentPath = string;
|
|
5
5
|
export type StylesheetAsset = {
|
|
6
6
|
type: 'inline';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RouteCache } from "./render/route-cache.js";
|
|
2
1
|
import { createI18nMiddleware } from "../i18n/middleware.js";
|
|
2
|
+
import { RouteCache } from "./render/route-cache.js";
|
|
3
3
|
class Pipeline {
|
|
4
4
|
constructor(logger, manifest, mode, renderers, resolve, serverLike, streaming, adapterName = manifest.adapterName, clientDirectives = manifest.clientDirectives, compressHTML = manifest.compressHTML, i18n = manifest.i18n, middleware = manifest.middleware, routeCache = new RouteCache(logger, mode), site = manifest.site) {
|
|
5
5
|
this.logger = logger;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { bgGreen, black, blue, bold, dim, green, magenta, red } from "kleur/colors";
|
|
2
1
|
import fs from "node:fs";
|
|
3
2
|
import os from "node:os";
|
|
4
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { bgGreen, black, blue, bold, dim, green, magenta, red } from "kleur/colors";
|
|
5
5
|
import PQueue from "p-queue";
|
|
6
6
|
import {
|
|
7
7
|
generateImagesForPath,
|
|
@@ -16,8 +16,10 @@ import {
|
|
|
16
16
|
removeLeadingForwardSlash,
|
|
17
17
|
removeTrailingForwardSlash
|
|
18
18
|
} from "../../core/path.js";
|
|
19
|
+
import { toRoutingStrategy } from "../../i18n/utils.js";
|
|
19
20
|
import { runHookBuildGenerated } from "../../integrations/index.js";
|
|
20
21
|
import { getOutputDirectory, isServerLikeOutput } from "../../prerender/utils.js";
|
|
22
|
+
import { NoPrerenderedRoutesWithDomains } from "../errors/errors-data.js";
|
|
21
23
|
import { AstroError, AstroErrorData } from "../errors/index.js";
|
|
22
24
|
import { routeIsFallback } from "../redirects/helpers.js";
|
|
23
25
|
import {
|
|
@@ -25,11 +27,11 @@ import {
|
|
|
25
27
|
getRedirectLocationOrThrow,
|
|
26
28
|
routeIsRedirect
|
|
27
29
|
} from "../redirects/index.js";
|
|
30
|
+
import { RenderContext } from "../render-context.js";
|
|
28
31
|
import { callGetStaticPaths } from "../render/route-cache.js";
|
|
29
32
|
import { createRequest } from "../request.js";
|
|
30
33
|
import { matchRoute } from "../routing/match.js";
|
|
31
34
|
import { getOutputFilename } from "../util.js";
|
|
32
|
-
import { BuildPipeline } from "./pipeline.js";
|
|
33
35
|
import { getOutDirWithinCwd, getOutFile, getOutFolder } from "./common.js";
|
|
34
36
|
import {
|
|
35
37
|
cssOrder,
|
|
@@ -37,10 +39,8 @@ import {
|
|
|
37
39
|
getPageDataByComponent,
|
|
38
40
|
mergeInlineCss
|
|
39
41
|
} from "./internal.js";
|
|
42
|
+
import { BuildPipeline } from "./pipeline.js";
|
|
40
43
|
import { getTimeStat, shouldAppendForwardSlash } from "./util.js";
|
|
41
|
-
import { NoPrerenderedRoutesWithDomains } from "../errors/errors-data.js";
|
|
42
|
-
import { RenderContext } from "../render-context.js";
|
|
43
|
-
import { toRoutingStrategy } from "../../i18n/utils.js";
|
|
44
44
|
function createEntryURL(filePath, outFolder) {
|
|
45
45
|
return new URL("./" + filePath + `?time=${Date.now()}`, outFolder);
|
|
46
46
|
}
|
|
@@ -242,12 +242,6 @@ async function getPathsForRoute(route, mod, pipeline, builtPaths) {
|
|
|
242
242
|
if (route.pathname) {
|
|
243
243
|
paths.push(route.pathname);
|
|
244
244
|
builtPaths.add(route.pathname);
|
|
245
|
-
for (const virtualRoute of route.fallbackRoutes) {
|
|
246
|
-
if (virtualRoute.pathname) {
|
|
247
|
-
paths.push(virtualRoute.pathname);
|
|
248
|
-
builtPaths.add(virtualRoute.pathname);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
245
|
} else {
|
|
252
246
|
const staticPaths = await callGetStaticPaths({
|
|
253
247
|
mod,
|
|
@@ -337,6 +331,12 @@ async function generatePath(pathname, pipeline, gopts, route) {
|
|
|
337
331
|
if (route.type === "page") {
|
|
338
332
|
addPageName(pathname, options);
|
|
339
333
|
}
|
|
334
|
+
if (route.type === "fallback" && // If route is index page, continue rendering. The index page should
|
|
335
|
+
// always be rendered
|
|
336
|
+
route.pathname !== "/" && // Check if there is a translated page with the same path
|
|
337
|
+
Object.values(options.allPages).some((val) => pathname.match(val.route.pattern))) {
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
340
|
const url = getUrlForPath(
|
|
341
341
|
pathname,
|
|
342
342
|
config.base,
|
package/dist/core/build/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { blue, bold, green } from "kleur/colors";
|
|
2
1
|
import fs from "node:fs";
|
|
3
2
|
import { performance } from "node:perf_hooks";
|
|
4
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { blue, bold, green } from "kleur/colors";
|
|
5
5
|
import { injectImageEndpoint } from "../../assets/endpoint/config.js";
|
|
6
6
|
import { telemetry } from "../../events/index.js";
|
|
7
7
|
import { eventCliSession } from "../../events/session.js";
|
|
@@ -19,10 +19,10 @@ import { createVite } from "../create-vite.js";
|
|
|
19
19
|
import { levels, timerMessage } from "../logger/core.js";
|
|
20
20
|
import { apply as applyPolyfill } from "../polyfill.js";
|
|
21
21
|
import { createRouteManifest } from "../routing/index.js";
|
|
22
|
+
import { ensureProcessNodeEnv } from "../util.js";
|
|
22
23
|
import { collectPagesData } from "./page-data.js";
|
|
23
24
|
import { staticBuild, viteBuild } from "./static-build.js";
|
|
24
25
|
import { getTimeStat } from "./util.js";
|
|
25
|
-
import { ensureProcessNodeEnv } from "../util.js";
|
|
26
26
|
async function build(inlineConfig, options = {}) {
|
|
27
27
|
ensureProcessNodeEnv("production");
|
|
28
28
|
applyPolyfill();
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import glob from "fast-glob";
|
|
2
1
|
import { fileURLToPath } from "node:url";
|
|
2
|
+
import glob from "fast-glob";
|
|
3
3
|
import {} from "vite";
|
|
4
|
+
import { normalizeTheLocale } from "../../../i18n/index.js";
|
|
5
|
+
import { toRoutingStrategy } from "../../../i18n/utils.js";
|
|
4
6
|
import { runHookBuildSsr } from "../../../integrations/index.js";
|
|
5
7
|
import { BEFORE_HYDRATION_SCRIPT_ID, PAGE_SCRIPT_ID } from "../../../vite-plugin-scripts/index.js";
|
|
6
8
|
import { joinPaths, prependForwardSlash } from "../../path.js";
|
|
@@ -8,8 +10,6 @@ import { serializeRouteData } from "../../routing/index.js";
|
|
|
8
10
|
import { addRollupInput } from "../add-rollup-input.js";
|
|
9
11
|
import { getOutFile, getOutFolder } from "../common.js";
|
|
10
12
|
import { cssOrder, mergeInlineCss } from "../internal.js";
|
|
11
|
-
import { normalizeTheLocale } from "../../../i18n/index.js";
|
|
12
|
-
import { toRoutingStrategy } from "../../../i18n/utils.js";
|
|
13
13
|
const manifestReplace = "@@ASTRO_MANIFEST_REPLACE@@";
|
|
14
14
|
const replaceExp = new RegExp(`['"]${manifestReplace}['"]`, "g");
|
|
15
15
|
const SSR_MANIFEST_VIRTUAL_MODULE_ID = "@astrojs-manifest";
|
|
@@ -6,10 +6,10 @@ import { routeIsRedirect } from "../../redirects/index.js";
|
|
|
6
6
|
import { addRollupInput } from "../add-rollup-input.js";
|
|
7
7
|
import { eachPageFromAllPages } from "../internal.js";
|
|
8
8
|
import { SSR_MANIFEST_VIRTUAL_MODULE_ID } from "./plugin-manifest.js";
|
|
9
|
+
import { MIDDLEWARE_MODULE_ID } from "./plugin-middleware.js";
|
|
9
10
|
import { ASTRO_PAGE_MODULE_ID } from "./plugin-pages.js";
|
|
10
11
|
import { RENDERERS_MODULE_ID } from "./plugin-renderers.js";
|
|
11
12
|
import { getPathFromVirtualModulePageName, getVirtualModulePageNameFromPath } from "./util.js";
|
|
12
|
-
import { MIDDLEWARE_MODULE_ID } from "./plugin-middleware.js";
|
|
13
13
|
const SSR_VIRTUAL_MODULE_ID = "@astrojs-ssr-virtual-entry";
|
|
14
14
|
const RESOLVED_SSR_VIRTUAL_MODULE_ID = "\0" + SSR_VIRTUAL_MODULE_ID;
|
|
15
15
|
function vitePluginSSR(internals, adapter, options) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BuildOptions,
|
|
1
|
+
import type { BuildOptions, Plugin as VitePlugin, Rollup } from 'vite';
|
|
2
2
|
type OutputOptionsHook = Extract<VitePlugin['outputOptions'], Function>;
|
|
3
3
|
type OutputOptions = Parameters<OutputOptionsHook>[0];
|
|
4
4
|
type ExtendManualChunksHooks = {
|
|
@@ -38,14 +38,15 @@ function getPathFromVirtualModulePageName(virtualModulePrefix, id) {
|
|
|
38
38
|
return pageName.replace(ASTRO_PAGE_EXTENSION_POST_PATTERN, ".");
|
|
39
39
|
}
|
|
40
40
|
function shouldInlineAsset(assetContent, assetPath, assetsInlineLimit) {
|
|
41
|
-
if (typeof assetsInlineLimit === "
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
if (typeof assetsInlineLimit === "function") {
|
|
42
|
+
const result = assetsInlineLimit(assetPath, Buffer.from(assetContent));
|
|
43
|
+
if (result != null) {
|
|
44
|
+
return result;
|
|
45
|
+
} else {
|
|
46
|
+
return Buffer.byteLength(assetContent) < 4096;
|
|
47
|
+
}
|
|
47
48
|
}
|
|
48
|
-
return Buffer.byteLength(assetContent) <
|
|
49
|
+
return Buffer.byteLength(assetContent) < Number(assetsInlineLimit);
|
|
49
50
|
}
|
|
50
51
|
export {
|
|
51
52
|
ASTRO_PAGE_EXTENSION_POST_PATTERN,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path, { extname } from "node:path";
|
|
3
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
1
4
|
import { teardown } from "@astrojs/compiler";
|
|
2
5
|
import * as eslexer from "es-module-lexer";
|
|
3
6
|
import glob from "fast-glob";
|
|
4
7
|
import { bgGreen, bgMagenta, black, green } from "kleur/colors";
|
|
5
|
-
import fs from "node:fs";
|
|
6
|
-
import path, { extname } from "node:path";
|
|
7
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
8
8
|
import * as vite from "vite";
|
|
9
9
|
import { PROPAGATED_ASSET_FLAG } from "../../content/consts.js";
|
|
10
10
|
import { hasAnyContentFlag } from "../../content/utils.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { build } from "esbuild";
|
|
2
1
|
import { fileURLToPath } from "node:url";
|
|
2
|
+
import { build } from "esbuild";
|
|
3
3
|
async function buildClientDirectiveEntrypoint(name, entrypoint, root) {
|
|
4
4
|
const stringifiedName = JSON.stringify(name);
|
|
5
5
|
const stringifiedEntrypoint = JSON.stringify(entrypoint);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { transform } from "@astrojs/compiler";
|
|
2
1
|
import { fileURLToPath } from "node:url";
|
|
2
|
+
import { transform } from "@astrojs/compiler";
|
|
3
3
|
import { normalizePath } from "vite";
|
|
4
4
|
import { AggregateError, CompilerError } from "../errors/errors.js";
|
|
5
5
|
import { AstroErrorData } from "../errors/index.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as colors from "kleur/colors";
|
|
2
1
|
import fs from "node:fs";
|
|
3
2
|
import path from "node:path";
|
|
4
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
+
import * as colors from "kleur/colors";
|
|
5
5
|
import { ZodError } from "zod";
|
|
6
6
|
import { eventConfigError, telemetry } from "../../events/index.js";
|
|
7
7
|
import { trackAstroConfigZodError } from "../errors/errors.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import yaml from "js-yaml";
|
|
2
1
|
import path from "node:path";
|
|
3
2
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
3
|
+
import yaml from "js-yaml";
|
|
4
4
|
import { getContentPaths } from "../../content/index.js";
|
|
5
5
|
import createPreferences from "../../preferences/index.js";
|
|
6
6
|
import { markdownContentEntryType } from "../../vite-plugin-markdown/content-entry-type.js";
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
import type * as vite from 'vite';
|
|
4
3
|
import type http from 'node:http';
|
|
5
4
|
import type { AddressInfo } from 'node:net';
|
|
5
|
+
import type * as vite from 'vite';
|
|
6
6
|
import type { AstroInlineConfig } from '../../@types/astro.js';
|
|
7
7
|
export interface DevServer {
|
|
8
8
|
address: AddressInfo;
|
package/dist/core/dev/dev.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { green } from "kleur/colors";
|
|
2
1
|
import fs from "node:fs";
|
|
2
|
+
import { green } from "kleur/colors";
|
|
3
3
|
import { performance } from "perf_hooks";
|
|
4
4
|
import { attachContentServerListeners } from "../../content/index.js";
|
|
5
5
|
import { telemetry } from "../../events/index.js";
|
|
6
6
|
import * as msg from "../messages.js";
|
|
7
|
+
import { ensureProcessNodeEnv } from "../util.js";
|
|
7
8
|
import { startContainer } from "./container.js";
|
|
8
9
|
import { createContainerWithAutomaticRestart } from "./restart.js";
|
|
9
|
-
import { ensureProcessNodeEnv } from "../util.js";
|
|
10
10
|
async function dev(inlineConfig) {
|
|
11
11
|
ensureProcessNodeEnv("development");
|
|
12
12
|
const devStart = performance.now();
|
|
@@ -23,7 +23,7 @@ async function dev(inlineConfig) {
|
|
|
23
23
|
base: restart.container.settings.config.base
|
|
24
24
|
})
|
|
25
25
|
);
|
|
26
|
-
const currentVersion = "4.4.
|
|
26
|
+
const currentVersion = "4.4.6";
|
|
27
27
|
if (currentVersion.includes("-")) {
|
|
28
28
|
logger.warn("SKIP_FORMAT", msg.prerelease({ currentVersion }));
|
|
29
29
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { APIContext, Locales, Params } from '../../@types/astro.js';
|
|
2
|
-
import type { AstroCookies } from '../cookies/index.js';
|
|
3
2
|
import { type RoutingStrategies } from '../../i18n/utils.js';
|
|
3
|
+
import type { AstroCookies } from '../cookies/index.js';
|
|
4
4
|
type CreateAPIContext = {
|
|
5
5
|
request: Request;
|
|
6
6
|
params: Params;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ASTRO_VERSION, clientAddressSymbol, clientLocalsSymbol } from "../constants.js";
|
|
2
|
-
import { AstroError, AstroErrorData } from "../errors/index.js";
|
|
3
1
|
import {
|
|
4
2
|
computeCurrentLocale,
|
|
5
3
|
computePreferredLocale,
|
|
6
4
|
computePreferredLocaleList
|
|
7
5
|
} from "../../i18n/utils.js";
|
|
6
|
+
import { ASTRO_VERSION, clientAddressSymbol, clientLocalsSymbol } from "../constants.js";
|
|
7
|
+
import { AstroError, AstroErrorData } from "../errors/index.js";
|
|
8
8
|
function createAPIContext({
|
|
9
9
|
request,
|
|
10
10
|
params,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { escape } from "html-escaper";
|
|
2
|
-
import { bold, underline } from "kleur/colors";
|
|
3
1
|
import * as fs from "node:fs";
|
|
4
2
|
import { isAbsolute, join } from "node:path";
|
|
5
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { escape } from "html-escaper";
|
|
5
|
+
import { bold, underline } from "kleur/colors";
|
|
6
6
|
import stripAnsi from "strip-ansi";
|
|
7
7
|
import { normalizePath } from "vite";
|
|
8
8
|
import { removeLeadingForwardSlashWindows } from "../../path.js";
|