astro 2.8.3 → 2.8.4
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/dist/@types/astro.d.ts +2 -2
- package/dist/assets/index.d.ts +0 -2
- package/dist/assets/index.js +0 -4
- package/dist/assets/services/vendor/squoosh/avif/avif_node_dec.js +3 -3
- package/dist/assets/services/vendor/squoosh/avif/avif_node_enc.js +3 -3
- package/dist/assets/services/vendor/squoosh/image-pool.js +2 -2
- package/dist/assets/services/vendor/squoosh/mozjpeg/mozjpeg_node_dec.js +3 -3
- package/dist/assets/services/vendor/squoosh/mozjpeg/mozjpeg_node_enc.js +3 -3
- package/dist/assets/services/vendor/squoosh/webp/webp_node_dec.js +3 -3
- package/dist/assets/services/vendor/squoosh/webp/webp_node_enc.js +3 -3
- package/dist/assets/utils/transformToPath.js +1 -1
- package/dist/assets/vendor/image-size/index.js +2 -2
- package/dist/assets/vendor/image-size/types/tiff.js +1 -1
- package/dist/cli/add/index.js +3 -3
- package/dist/cli/check/index.d.ts +1 -1
- package/dist/cli/check/index.js +2 -2
- package/dist/cli/check/print.js +1 -1
- package/dist/cli/dev/index.js +1 -1
- package/dist/cli/load-settings.js +1 -1
- package/dist/cli/sync/index.js +1 -1
- package/dist/config/index.js +1 -1
- package/dist/content/runtime-assets.js +1 -1
- package/dist/content/vite-plugin-content-imports.js +1 -1
- package/dist/core/app/index.d.ts +3 -1
- package/dist/core/app/index.js +33 -47
- package/dist/core/app/node.d.ts +1 -1
- package/dist/core/app/node.js +3 -3
- package/dist/core/build/common.js +2 -2
- package/dist/core/build/css-asset-name.js +2 -2
- package/dist/core/build/generate.d.ts +1 -1
- package/dist/core/build/generate.js +13 -42
- package/dist/core/build/index.js +9 -2
- package/dist/core/build/static-build.js +3 -4
- package/dist/core/compile/compile.js +1 -1
- package/dist/core/compile/style.js +1 -1
- package/dist/core/config/config.d.ts +1 -1
- package/dist/core/config/config.js +3 -3
- package/dist/core/config/schema.d.ts +1 -1
- package/dist/core/config/settings.js +1 -1
- package/dist/core/config/timer.js +1 -1
- package/dist/core/config/tsconfig.js +2 -2
- package/dist/core/config/vite-load.d.ts +1 -1
- package/dist/core/config/vite-load.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/create-vite.d.ts +1 -1
- package/dist/core/create-vite.js +2 -2
- package/dist/core/dev/container.d.ts +3 -3
- package/dist/core/dev/container.js +1 -1
- package/dist/core/dev/dev.d.ts +2 -2
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/errors/dev/vite.js +2 -2
- package/dist/core/fs/index.js +4 -4
- package/dist/core/logger/node.d.ts +1 -1
- package/dist/core/logger/node.js +2 -2
- package/dist/core/messages.js +2 -2
- package/dist/core/module-loader/loader.d.ts +1 -1
- package/dist/core/module-loader/loader.js +1 -1
- package/dist/core/module-loader/vite.js +1 -1
- package/dist/core/preview/index.js +1 -1
- package/dist/core/preview/static-preview-server.d.ts +1 -1
- package/dist/core/preview/static-preview-server.js +1 -1
- package/dist/core/preview/vite-plugin-astro-preview.js +2 -2
- package/dist/core/render/core.d.ts +9 -2
- package/dist/core/render/core.js +34 -1
- package/dist/core/render/dev/environment.d.ts +2 -2
- package/dist/core/render/dev/environment.js +6 -7
- package/dist/core/render/dev/index.js +3 -29
- package/dist/core/render/dev/vite.js +1 -1
- package/dist/core/render/index.d.ts +1 -1
- package/dist/core/render/index.js +2 -2
- package/dist/core/request.d.ts +1 -1
- package/dist/core/routing/manifest/create.d.ts +1 -1
- package/dist/core/routing/manifest/create.js +3 -3
- package/dist/core/util.js +3 -3
- package/dist/integrations/index.d.ts +1 -1
- package/dist/vite-plugin-astro-server/base.js +1 -1
- package/dist/vite-plugin-astro-server/plugin.d.ts +10 -2
- package/dist/vite-plugin-astro-server/plugin.js +34 -9
- package/dist/vite-plugin-astro-server/request.d.ts +12 -3
- package/dist/vite-plugin-astro-server/request.js +23 -15
- package/dist/vite-plugin-astro-server/response.d.ts +1 -1
- package/dist/vite-plugin-astro-server/route.d.ts +15 -3
- package/dist/vite-plugin-astro-server/route.js +32 -20
- package/dist/vite-plugin-config-alias/index.js +1 -1
- package/dist/vite-plugin-env/index.js +5 -2
- package/dist/vite-plugin-jsx/index.js +1 -1
- package/dist/vite-plugin-load-fallback/index.d.ts +1 -1
- package/dist/vite-plugin-load-fallback/index.js +2 -2
- package/dist/vite-plugin-utils/index.js +1 -1
- package/package.json +3 -3
package/dist/@types/astro.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
/// <reference types="node" />
|
|
4
4
|
import type { MarkdownHeading, MarkdownMetadata, MarkdownRenderingResult, RehypePlugins, RemarkPlugins, RemarkRehype, ShikiConfig } from '@astrojs/markdown-remark';
|
|
5
5
|
import type * as babel from '@babel/core';
|
|
6
|
-
import type { OutgoingHttpHeaders } from 'http';
|
|
7
|
-
import type { AddressInfo } from 'net';
|
|
6
|
+
import type { OutgoingHttpHeaders } from 'node:http';
|
|
7
|
+
import type { AddressInfo } from 'node:net';
|
|
8
8
|
import type * as rollup from 'rollup';
|
|
9
9
|
import type { TsConfigJson } from 'tsconfig-resolver';
|
|
10
10
|
import type * as vite from 'vite';
|
package/dist/assets/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
export { getConfiguredImageService, getImage } from './internal.js';
|
|
2
2
|
export { baseService, isLocalService } from './services/service.js';
|
|
3
3
|
export { type LocalImageProps, type RemoteImageProps } from './types.js';
|
|
4
|
-
export { emitESMImage } from './utils/emitAsset.js';
|
|
5
|
-
export { imageMetadata } from './utils/metadata.js';
|
package/dist/assets/index.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { getConfiguredImageService, getImage } from "./internal.js";
|
|
2
2
|
import { baseService, isLocalService } from "./services/service.js";
|
|
3
3
|
import {} from "./types.js";
|
|
4
|
-
import { emitESMImage } from "./utils/emitAsset.js";
|
|
5
|
-
import { imageMetadata } from "./utils/metadata.js";
|
|
6
4
|
export {
|
|
7
5
|
baseService,
|
|
8
|
-
emitESMImage,
|
|
9
6
|
getConfiguredImageService,
|
|
10
7
|
getImage,
|
|
11
|
-
imageMetadata,
|
|
12
8
|
isLocalService
|
|
13
9
|
};
|
|
@@ -37,15 +37,15 @@ var Module = function() {
|
|
|
37
37
|
var nodePath;
|
|
38
38
|
if (ENVIRONMENT_IS_NODE) {
|
|
39
39
|
if (ENVIRONMENT_IS_WORKER) {
|
|
40
|
-
scriptDirectory = require2("path").dirname(scriptDirectory) + "/";
|
|
40
|
+
scriptDirectory = require2("node:path").dirname(scriptDirectory) + "/";
|
|
41
41
|
} else {
|
|
42
42
|
scriptDirectory = dirname(getModuleURL(import.meta.url)) + "/";
|
|
43
43
|
}
|
|
44
44
|
read_ = function shell_read(filename, binary) {
|
|
45
45
|
if (!nodeFS)
|
|
46
|
-
nodeFS = require2("fs");
|
|
46
|
+
nodeFS = require2("node:fs");
|
|
47
47
|
if (!nodePath)
|
|
48
|
-
nodePath = require2("path");
|
|
48
|
+
nodePath = require2("node:path");
|
|
49
49
|
filename = nodePath["normalize"](filename);
|
|
50
50
|
return nodeFS["readFileSync"](filename, binary ? null : "utf8");
|
|
51
51
|
};
|
|
@@ -37,15 +37,15 @@ var Module = function() {
|
|
|
37
37
|
var nodePath;
|
|
38
38
|
if (ENVIRONMENT_IS_NODE) {
|
|
39
39
|
if (ENVIRONMENT_IS_WORKER) {
|
|
40
|
-
scriptDirectory = require2("path").dirname(scriptDirectory) + "/";
|
|
40
|
+
scriptDirectory = require2("node:path").dirname(scriptDirectory) + "/";
|
|
41
41
|
} else {
|
|
42
42
|
scriptDirectory = dirname(getModuleURL(import.meta.url)) + "/";
|
|
43
43
|
}
|
|
44
44
|
read_ = function shell_read(filename, binary) {
|
|
45
45
|
if (!nodeFS)
|
|
46
|
-
nodeFS = require2("fs");
|
|
46
|
+
nodeFS = require2("node:fs");
|
|
47
47
|
if (!nodePath)
|
|
48
|
-
nodePath = require2("path");
|
|
48
|
+
nodePath = require2("node:path");
|
|
49
49
|
filename = nodePath["normalize"](filename);
|
|
50
50
|
return nodeFS["readFileSync"](filename, binary ? null : "utf8");
|
|
51
51
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { cpus } from "node:os";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
1
3
|
import { isMainThread } from "node:worker_threads";
|
|
2
|
-
import { cpus } from "os";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
4
|
import { getModuleURL } from "./emscripten-utils.js";
|
|
5
5
|
import * as impl from "./impl.js";
|
|
6
6
|
import execOnce from "./utils/execOnce.js";
|
|
@@ -37,15 +37,15 @@ var Module = function() {
|
|
|
37
37
|
var nodePath;
|
|
38
38
|
if (ENVIRONMENT_IS_NODE) {
|
|
39
39
|
if (ENVIRONMENT_IS_WORKER) {
|
|
40
|
-
scriptDirectory = require2("path").dirname(scriptDirectory) + "/";
|
|
40
|
+
scriptDirectory = require2("node:path").dirname(scriptDirectory) + "/";
|
|
41
41
|
} else {
|
|
42
42
|
scriptDirectory = dirname(getModuleURL(import.meta.url)) + "/";
|
|
43
43
|
}
|
|
44
44
|
read_ = function shell_read(filename, binary) {
|
|
45
45
|
if (!nodeFS)
|
|
46
|
-
nodeFS = require2("fs");
|
|
46
|
+
nodeFS = require2("node:fs");
|
|
47
47
|
if (!nodePath)
|
|
48
|
-
nodePath = require2("path");
|
|
48
|
+
nodePath = require2("node:path");
|
|
49
49
|
filename = nodePath["normalize"](filename);
|
|
50
50
|
return nodeFS["readFileSync"](filename, binary ? null : "utf8");
|
|
51
51
|
};
|
|
@@ -37,15 +37,15 @@ var Module = function() {
|
|
|
37
37
|
var nodePath;
|
|
38
38
|
if (ENVIRONMENT_IS_NODE) {
|
|
39
39
|
if (ENVIRONMENT_IS_WORKER) {
|
|
40
|
-
scriptDirectory = require2("path").dirname(scriptDirectory) + "/";
|
|
40
|
+
scriptDirectory = require2("node:path").dirname(scriptDirectory) + "/";
|
|
41
41
|
} else {
|
|
42
42
|
scriptDirectory = dirname(getModuleURL(import.meta.url)) + "/";
|
|
43
43
|
}
|
|
44
44
|
read_ = function shell_read(filename, binary) {
|
|
45
45
|
if (!nodeFS)
|
|
46
|
-
nodeFS = require2("fs");
|
|
46
|
+
nodeFS = require2("node:fs");
|
|
47
47
|
if (!nodePath)
|
|
48
|
-
nodePath = require2("path");
|
|
48
|
+
nodePath = require2("node:path");
|
|
49
49
|
filename = nodePath["normalize"](filename);
|
|
50
50
|
return nodeFS["readFileSync"](filename, binary ? null : "utf8");
|
|
51
51
|
};
|
|
@@ -37,15 +37,15 @@ var Module = function() {
|
|
|
37
37
|
var nodePath;
|
|
38
38
|
if (ENVIRONMENT_IS_NODE) {
|
|
39
39
|
if (ENVIRONMENT_IS_WORKER) {
|
|
40
|
-
scriptDirectory = require2("path").dirname(scriptDirectory) + "/";
|
|
40
|
+
scriptDirectory = require2("node:path").dirname(scriptDirectory) + "/";
|
|
41
41
|
} else {
|
|
42
42
|
scriptDirectory = dirname(getModuleURL(import.meta.url)) + "/";
|
|
43
43
|
}
|
|
44
44
|
read_ = function shell_read(filename, binary) {
|
|
45
45
|
if (!nodeFS)
|
|
46
|
-
nodeFS = require2("fs");
|
|
46
|
+
nodeFS = require2("node:fs");
|
|
47
47
|
if (!nodePath)
|
|
48
|
-
nodePath = require2("path");
|
|
48
|
+
nodePath = require2("node:path");
|
|
49
49
|
filename = nodePath["normalize"](filename);
|
|
50
50
|
return nodeFS["readFileSync"](filename, binary ? null : "utf8");
|
|
51
51
|
};
|
|
@@ -37,15 +37,15 @@ var Module = function() {
|
|
|
37
37
|
var nodePath;
|
|
38
38
|
if (ENVIRONMENT_IS_NODE) {
|
|
39
39
|
if (ENVIRONMENT_IS_WORKER) {
|
|
40
|
-
scriptDirectory = require2("path").dirname(scriptDirectory) + "/";
|
|
40
|
+
scriptDirectory = require2("node:path").dirname(scriptDirectory) + "/";
|
|
41
41
|
} else {
|
|
42
42
|
scriptDirectory = dirname(getModuleURL(import.meta.url)) + "/";
|
|
43
43
|
}
|
|
44
44
|
read_ = function shell_read(filename, binary) {
|
|
45
45
|
if (!nodeFS)
|
|
46
|
-
nodeFS = require2("fs");
|
|
46
|
+
nodeFS = require2("node:fs");
|
|
47
47
|
if (!nodePath)
|
|
48
|
-
nodePath = require2("path");
|
|
48
|
+
nodePath = require2("node:path");
|
|
49
49
|
filename = nodePath["normalize"](filename);
|
|
50
50
|
return nodeFS["readFileSync"](filename, binary ? null : "utf8");
|
|
51
51
|
};
|
package/dist/cli/add/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import boxen from "boxen";
|
|
2
2
|
import { diffWords } from "diff";
|
|
3
3
|
import { execa } from "execa";
|
|
4
|
-
import fsMod, { existsSync, promises as fs } from "fs";
|
|
5
4
|
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";
|
|
6
8
|
import ora from "ora";
|
|
7
|
-
import path from "path";
|
|
8
9
|
import preferredPM from "preferred-pm";
|
|
9
10
|
import prompts from "prompts";
|
|
10
|
-
import { fileURLToPath, pathToFileURL } from "url";
|
|
11
11
|
import { loadTSConfig, resolveConfigPath } from "../../core/config/index.js";
|
|
12
12
|
import {
|
|
13
13
|
defaultTSConfig,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { AstroCheck } from '@astrojs/language-server';
|
|
3
|
-
import fs from 'fs';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
4
|
import type { Arguments as Flags } from 'yargs-parser';
|
|
5
5
|
import type { AstroSettings } from '../../@types/astro';
|
|
6
6
|
import type { LogOptions } from '../../core/logger/core.js';
|
package/dist/cli/check/index.js
CHANGED
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
DiagnosticSeverity
|
|
4
4
|
} from "@astrojs/language-server";
|
|
5
5
|
import glob from "fast-glob";
|
|
6
|
-
import fs from "fs";
|
|
7
6
|
import { bold, dim, red, yellow } from "kleur/colors";
|
|
8
7
|
import { createRequire } from "module";
|
|
8
|
+
import fs from "node:fs";
|
|
9
9
|
import { join } from "node:path";
|
|
10
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
10
11
|
import ora from "ora";
|
|
11
|
-
import { fileURLToPath, pathToFileURL } from "url";
|
|
12
12
|
import { debug, info } from "../../core/logger/core.js";
|
|
13
13
|
import { printHelp } from "../../core/messages.js";
|
|
14
14
|
import { loadSettings } from "../load-settings.js";
|
package/dist/cli/check/print.js
CHANGED
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
white,
|
|
12
12
|
yellow
|
|
13
13
|
} from "kleur/colors";
|
|
14
|
+
import { fileURLToPath } from "node:url";
|
|
14
15
|
import stringWidth from "string-width";
|
|
15
|
-
import { fileURLToPath } from "url";
|
|
16
16
|
function printDiagnostic(filePath, text, diag) {
|
|
17
17
|
let result = [];
|
|
18
18
|
const realStartLine = diag.range.start.line + 1;
|
package/dist/cli/dev/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
1
|
import * as colors from "kleur/colors";
|
|
2
|
+
import fs from "node:fs";
|
|
3
3
|
import { ZodError } from "zod";
|
|
4
4
|
import { createSettings, openConfig, resolveConfigPath } from "../core/config/index.js";
|
|
5
5
|
import { collectErrorMetadata } from "../core/errors/dev/index.js";
|
package/dist/cli/sync/index.js
CHANGED
package/dist/config/index.js
CHANGED
|
@@ -13,7 +13,7 @@ function getViteConfig(inlineConfig) {
|
|
|
13
13
|
{ runHookConfigSetup, runHookConfigDone },
|
|
14
14
|
{ astroContentListenPlugin }
|
|
15
15
|
] = await Promise.all([
|
|
16
|
-
import("fs"),
|
|
16
|
+
import("node:fs"),
|
|
17
17
|
import("vite"),
|
|
18
18
|
import("../core/logger/node.js"),
|
|
19
19
|
import("../core/config/index.js"),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { emitESMImage } from "../assets/
|
|
2
|
+
import { emitESMImage } from "../assets/utils/emitAsset.js";
|
|
3
3
|
function createImage(pluginContext, entryFilePath) {
|
|
4
4
|
return () => {
|
|
5
5
|
return z.string().transform(async (imagePath, ctx) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as devalue from "devalue";
|
|
2
2
|
import { extname } from "node:path";
|
|
3
|
-
import { pathToFileURL } from "url";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
4
4
|
import { AstroErrorData } from "../core/errors/errors-data.js";
|
|
5
5
|
import { AstroError } from "../core/errors/errors.js";
|
|
6
6
|
import { escapeViteEnvReferences } from "../vite-plugin-utils/index.js";
|
package/dist/core/app/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RouteData, SSRManifest } from '../../@types/astro';
|
|
1
|
+
import type { ManifestData, RouteData, SSRManifest } from '../../@types/astro';
|
|
2
2
|
export { deserializeManifest } from './common.js';
|
|
3
3
|
export interface MatchOptions {
|
|
4
4
|
matchNotFound?: boolean | undefined;
|
|
@@ -6,6 +6,8 @@ export interface MatchOptions {
|
|
|
6
6
|
export declare class App {
|
|
7
7
|
#private;
|
|
8
8
|
constructor(manifest: SSRManifest, streaming?: boolean);
|
|
9
|
+
set setManifest(newManifest: SSRManifest);
|
|
10
|
+
set setManifestData(newManifestData: ManifestData);
|
|
9
11
|
removeBase(pathname: string): string;
|
|
10
12
|
match(request: Request, { matchNotFound }?: MatchOptions): RouteData | undefined;
|
|
11
13
|
render(request: Request, routeData?: RouteData, locals?: object): Promise<Response>;
|
package/dist/core/app/index.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import mime from "mime";
|
|
2
2
|
import { attachToResponse, getSetCookiesFromResponse } from "../cookies/index.js";
|
|
3
|
-
import { callEndpoint
|
|
3
|
+
import { callEndpoint } from "../endpoint/index.js";
|
|
4
4
|
import { consoleLogDestination } from "../logger/console.js";
|
|
5
5
|
import { error } from "../logger/core.js";
|
|
6
|
-
import { callMiddleware } from "../middleware/callMiddleware.js";
|
|
7
6
|
import { prependForwardSlash, removeTrailingForwardSlash } from "../path.js";
|
|
8
7
|
import { RedirectSinglePageBuiltModule } from "../redirects/index.js";
|
|
9
8
|
import {
|
|
10
9
|
createEnvironment,
|
|
11
10
|
createRenderContext,
|
|
12
|
-
|
|
11
|
+
tryRenderPage
|
|
13
12
|
} from "../render/index.js";
|
|
14
13
|
import { RouteCache } from "../render/route-cache.js";
|
|
15
14
|
import {
|
|
@@ -22,6 +21,9 @@ import { deserializeManifest } from "./common.js";
|
|
|
22
21
|
const clientLocalsSymbol = Symbol.for("astro.locals");
|
|
23
22
|
const responseSentSymbol = Symbol.for("astro.responseSent");
|
|
24
23
|
class App {
|
|
24
|
+
/**
|
|
25
|
+
* The current environment of the application
|
|
26
|
+
*/
|
|
25
27
|
#env;
|
|
26
28
|
#manifest;
|
|
27
29
|
#manifestData;
|
|
@@ -31,7 +33,6 @@ class App {
|
|
|
31
33
|
dest: consoleLogDestination,
|
|
32
34
|
level: "info"
|
|
33
35
|
};
|
|
34
|
-
#base;
|
|
35
36
|
#baseWithoutTrailingSlash;
|
|
36
37
|
constructor(manifest, streaming = true) {
|
|
37
38
|
this.#manifest = manifest;
|
|
@@ -39,26 +40,39 @@ class App {
|
|
|
39
40
|
routes: manifest.routes.map((route) => route.routeData)
|
|
40
41
|
};
|
|
41
42
|
this.#routeDataToRouteInfo = new Map(manifest.routes.map((route) => [route.routeData, route]));
|
|
42
|
-
this.#
|
|
43
|
-
|
|
43
|
+
this.#baseWithoutTrailingSlash = removeTrailingForwardSlash(this.#manifest.base);
|
|
44
|
+
this.#env = this.#createEnvironment(streaming);
|
|
45
|
+
}
|
|
46
|
+
set setManifest(newManifest) {
|
|
47
|
+
this.#manifest = newManifest;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Creates an environment by reading the stored manifest
|
|
51
|
+
*
|
|
52
|
+
* @param streaming
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
#createEnvironment(streaming = false) {
|
|
56
|
+
return createEnvironment({
|
|
57
|
+
adapterName: this.#manifest.adapterName,
|
|
44
58
|
logging: this.#logging,
|
|
45
|
-
markdown: manifest.markdown,
|
|
59
|
+
markdown: this.#manifest.markdown,
|
|
46
60
|
mode: "production",
|
|
47
|
-
compressHTML: manifest.compressHTML,
|
|
48
|
-
renderers: manifest.renderers,
|
|
49
|
-
clientDirectives: manifest.clientDirectives,
|
|
50
|
-
async
|
|
51
|
-
if (!(specifier in manifest.entryModules)) {
|
|
61
|
+
compressHTML: this.#manifest.compressHTML,
|
|
62
|
+
renderers: this.#manifest.renderers,
|
|
63
|
+
clientDirectives: this.#manifest.clientDirectives,
|
|
64
|
+
resolve: async (specifier) => {
|
|
65
|
+
if (!(specifier in this.#manifest.entryModules)) {
|
|
52
66
|
throw new Error(`Unable to resolve [${specifier}]`);
|
|
53
67
|
}
|
|
54
|
-
const bundlePath = manifest.entryModules[specifier];
|
|
68
|
+
const bundlePath = this.#manifest.entryModules[specifier];
|
|
55
69
|
switch (true) {
|
|
56
70
|
case bundlePath.startsWith("data:"):
|
|
57
71
|
case bundlePath.length === 0: {
|
|
58
72
|
return bundlePath;
|
|
59
73
|
}
|
|
60
74
|
default: {
|
|
61
|
-
return createAssetLink(bundlePath, manifest.base, manifest.assetsPrefix);
|
|
75
|
+
return createAssetLink(bundlePath, this.#manifest.base, this.#manifest.assetsPrefix);
|
|
62
76
|
}
|
|
63
77
|
}
|
|
64
78
|
},
|
|
@@ -67,11 +81,12 @@ class App {
|
|
|
67
81
|
ssr: true,
|
|
68
82
|
streaming
|
|
69
83
|
});
|
|
70
|
-
|
|
71
|
-
|
|
84
|
+
}
|
|
85
|
+
set setManifestData(newManifestData) {
|
|
86
|
+
this.#manifestData = newManifestData;
|
|
72
87
|
}
|
|
73
88
|
removeBase(pathname) {
|
|
74
|
-
if (pathname.startsWith(this.#base)) {
|
|
89
|
+
if (pathname.startsWith(this.#manifest.base)) {
|
|
75
90
|
return pathname.slice(this.#baseWithoutTrailingSlash.length + 1);
|
|
76
91
|
}
|
|
77
92
|
return pathname;
|
|
@@ -200,36 +215,7 @@ class App {
|
|
|
200
215
|
mod,
|
|
201
216
|
env: this.#env
|
|
202
217
|
});
|
|
203
|
-
const
|
|
204
|
-
request: renderContext.request,
|
|
205
|
-
params: renderContext.params,
|
|
206
|
-
props: renderContext.props,
|
|
207
|
-
site: this.#env.site,
|
|
208
|
-
adapterName: this.#env.adapterName
|
|
209
|
-
});
|
|
210
|
-
let response;
|
|
211
|
-
if (page.onRequest) {
|
|
212
|
-
response = await callMiddleware(
|
|
213
|
-
this.#env.logging,
|
|
214
|
-
page.onRequest,
|
|
215
|
-
apiContext,
|
|
216
|
-
() => {
|
|
217
|
-
return renderPage({
|
|
218
|
-
mod,
|
|
219
|
-
renderContext,
|
|
220
|
-
env: this.#env,
|
|
221
|
-
cookies: apiContext.cookies
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
);
|
|
225
|
-
} else {
|
|
226
|
-
response = await renderPage({
|
|
227
|
-
mod,
|
|
228
|
-
renderContext,
|
|
229
|
-
env: this.#env,
|
|
230
|
-
cookies: apiContext.cookies
|
|
231
|
-
});
|
|
232
|
-
}
|
|
218
|
+
const response = await tryRenderPage(renderContext, this.#env, mod, page.onRequest);
|
|
233
219
|
Reflect.set(request, responseSentSymbol, true);
|
|
234
220
|
return response;
|
|
235
221
|
} catch (err) {
|
package/dist/core/app/node.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { RouteData } from '../../@types/astro';
|
|
3
3
|
import type { SSRManifest } from './types';
|
|
4
|
-
import { IncomingMessage } from 'http';
|
|
4
|
+
import { IncomingMessage } from 'node:http';
|
|
5
5
|
import { App, type MatchOptions } from './index.js';
|
|
6
6
|
declare class NodeIncomingMessage extends IncomingMessage {
|
|
7
7
|
/**
|
package/dist/core/app/node.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as fs from "fs";
|
|
2
|
-
import { IncomingMessage } from "http";
|
|
3
|
-
import { TLSSocket } from "tls";
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import { IncomingMessage } from "node:http";
|
|
3
|
+
import { TLSSocket } from "node:tls";
|
|
4
4
|
import { deserializeManifest } from "./common.js";
|
|
5
5
|
import { App } from "./index.js";
|
|
6
6
|
const clientAddressSymbol = Symbol.for("astro.clientAddress");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import npath from "path";
|
|
2
|
-
import { fileURLToPath, pathToFileURL } from "url";
|
|
1
|
+
import npath from "node:path";
|
|
2
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
3
3
|
import { appendForwardSlash } from "../../core/path.js";
|
|
4
4
|
const STATUS_CODE_PAGES = /* @__PURE__ */ new Set(["/404", "/500"]);
|
|
5
5
|
const FALLBACK_OUT_DIR_NAME = "./.astro/";
|
|
@@ -12,4 +12,4 @@ export declare function generatePages(opts: StaticBuildOptions, internals: Build
|
|
|
12
12
|
* @param settings
|
|
13
13
|
* @param renderers
|
|
14
14
|
*/
|
|
15
|
-
export declare function
|
|
15
|
+
export declare function createBuildManifest(settings: AstroSettings, internals: BuildInternals, renderers: SSRLoadedRenderer[]): SSRManifest;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
1
|
import * as colors from "kleur/colors";
|
|
3
2
|
import { bgGreen, black, cyan, dim, green, magenta } from "kleur/colors";
|
|
4
|
-
import
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
5
|
import {
|
|
6
6
|
generateImage as generateImageInternal,
|
|
7
7
|
getStaticImageList
|
|
@@ -20,16 +20,15 @@ import {
|
|
|
20
20
|
import { runHookBuildGenerated } from "../../integrations/index.js";
|
|
21
21
|
import { isServerLikeOutput } from "../../prerender/utils.js";
|
|
22
22
|
import { BEFORE_HYDRATION_SCRIPT_ID, PAGE_SCRIPT_ID } from "../../vite-plugin-scripts/index.js";
|
|
23
|
-
import { callEndpoint,
|
|
23
|
+
import { callEndpoint, throwIfRedirectNotAllowed } from "../endpoint/index.js";
|
|
24
24
|
import { AstroError, AstroErrorData } from "../errors/index.js";
|
|
25
25
|
import { debug, info } from "../logger/core.js";
|
|
26
|
-
import { callMiddleware } from "../middleware/callMiddleware.js";
|
|
27
26
|
import {
|
|
28
27
|
getRedirectLocationOrThrow,
|
|
29
28
|
RedirectSinglePageBuiltModule,
|
|
30
29
|
routeIsRedirect
|
|
31
30
|
} from "../redirects/index.js";
|
|
32
|
-
import { createEnvironment, createRenderContext,
|
|
31
|
+
import { createEnvironment, createRenderContext, tryRenderPage } from "../render/index.js";
|
|
33
32
|
import { callGetStaticPaths } from "../render/route-cache.js";
|
|
34
33
|
import {
|
|
35
34
|
createAssetLink,
|
|
@@ -115,26 +114,26 @@ ${bgGreen(black(` ${verb} static routes `))}`);
|
|
|
115
114
|
}
|
|
116
115
|
} else {
|
|
117
116
|
const ssrEntry = ssrEntryPage;
|
|
118
|
-
const manifest =
|
|
117
|
+
const manifest = createBuildManifest(opts.settings, internals, ssrEntry.renderers);
|
|
119
118
|
await generatePage(opts, internals, pageData, ssrEntry, builtPaths, manifest);
|
|
120
119
|
}
|
|
121
120
|
}
|
|
122
121
|
}
|
|
123
122
|
for (const pageData of eachRedirectPageData(internals)) {
|
|
124
123
|
const entry = await getEntryForRedirectRoute(pageData.route, internals, outFolder);
|
|
125
|
-
const manifest =
|
|
124
|
+
const manifest = createBuildManifest(opts.settings, internals, entry.renderers);
|
|
126
125
|
await generatePage(opts, internals, pageData, entry, builtPaths, manifest);
|
|
127
126
|
}
|
|
128
127
|
} else {
|
|
129
128
|
for (const [pageData, filePath] of eachPageDataFromEntryPoint(internals)) {
|
|
130
129
|
const ssrEntryURLPage = createEntryURL(filePath, outFolder);
|
|
131
130
|
const entry = await import(ssrEntryURLPage.toString());
|
|
132
|
-
const manifest =
|
|
131
|
+
const manifest = createBuildManifest(opts.settings, internals, entry.renderers);
|
|
133
132
|
await generatePage(opts, internals, pageData, entry, builtPaths, manifest);
|
|
134
133
|
}
|
|
135
134
|
for (const pageData of eachRedirectPageData(internals)) {
|
|
136
135
|
const entry = await getEntryForRedirectRoute(pageData.route, internals, outFolder);
|
|
137
|
-
const manifest =
|
|
136
|
+
const manifest = createBuildManifest(opts.settings, internals, entry.renderers);
|
|
138
137
|
await generatePage(opts, internals, pageData, entry, builtPaths, manifest);
|
|
139
138
|
}
|
|
140
139
|
}
|
|
@@ -373,7 +372,7 @@ async function generatePath(pathname, opts, gopts, manifest, onRequest) {
|
|
|
373
372
|
clientDirectives: manifest.clientDirectives,
|
|
374
373
|
compressHTML: manifest.compressHTML,
|
|
375
374
|
async resolve(specifier) {
|
|
376
|
-
const hashedFilePath =
|
|
375
|
+
const hashedFilePath = manifest.entryModules[specifier];
|
|
377
376
|
if (typeof hashedFilePath !== "string") {
|
|
378
377
|
if (specifier === BEFORE_HYDRATION_SCRIPT_ID) {
|
|
379
378
|
return "";
|
|
@@ -421,35 +420,7 @@ async function generatePath(pathname, opts, gopts, manifest, onRequest) {
|
|
|
421
420
|
} else {
|
|
422
421
|
let response;
|
|
423
422
|
try {
|
|
424
|
-
|
|
425
|
-
request: renderContext.request,
|
|
426
|
-
params: renderContext.params,
|
|
427
|
-
props: renderContext.props,
|
|
428
|
-
site: env.site,
|
|
429
|
-
adapterName: env.adapterName
|
|
430
|
-
});
|
|
431
|
-
if (onRequest) {
|
|
432
|
-
response = await callMiddleware(
|
|
433
|
-
env.logging,
|
|
434
|
-
onRequest,
|
|
435
|
-
apiContext,
|
|
436
|
-
() => {
|
|
437
|
-
return renderPage({
|
|
438
|
-
mod,
|
|
439
|
-
renderContext,
|
|
440
|
-
env,
|
|
441
|
-
cookies: apiContext.cookies
|
|
442
|
-
});
|
|
443
|
-
}
|
|
444
|
-
);
|
|
445
|
-
} else {
|
|
446
|
-
response = await renderPage({
|
|
447
|
-
mod,
|
|
448
|
-
renderContext,
|
|
449
|
-
env,
|
|
450
|
-
cookies: apiContext.cookies
|
|
451
|
-
});
|
|
452
|
-
}
|
|
423
|
+
response = await tryRenderPage(renderContext, env, mod, onRequest);
|
|
453
424
|
} catch (err) {
|
|
454
425
|
if (!AstroError.is(err) && !err.id && typeof err === "object") {
|
|
455
426
|
err.id = pageData.component;
|
|
@@ -486,10 +457,10 @@ async function generatePath(pathname, opts, gopts, manifest, onRequest) {
|
|
|
486
457
|
await fs.promises.mkdir(outFolder, { recursive: true });
|
|
487
458
|
await fs.promises.writeFile(outFile, body, encoding ?? "utf-8");
|
|
488
459
|
}
|
|
489
|
-
function
|
|
460
|
+
function createBuildManifest(settings, internals, renderers) {
|
|
490
461
|
return {
|
|
491
462
|
assets: /* @__PURE__ */ new Set(),
|
|
492
|
-
entryModules:
|
|
463
|
+
entryModules: Object.fromEntries(internals.entrySpecifierToBundleMap.entries()),
|
|
493
464
|
routes: [],
|
|
494
465
|
adapterName: "",
|
|
495
466
|
markdown: settings.config.markdown,
|
|
@@ -504,7 +475,7 @@ function generateRuntimeManifest(settings, internals, renderers) {
|
|
|
504
475
|
}
|
|
505
476
|
export {
|
|
506
477
|
chunkIsPage,
|
|
478
|
+
createBuildManifest,
|
|
507
479
|
generatePages,
|
|
508
|
-
generateRuntimeManifest,
|
|
509
480
|
rootRelativeFacadeId
|
|
510
481
|
};
|
package/dist/core/build/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
1
|
import * as colors from "kleur/colors";
|
|
3
|
-
import
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import { performance } from "node:perf_hooks";
|
|
4
4
|
import {
|
|
5
5
|
runHookBuildDone,
|
|
6
6
|
runHookBuildStart,
|
|
@@ -176,6 +176,13 @@ class AstroBuilder {
|
|
|
176
176
|
);
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
+
if (config.build.split === true) {
|
|
180
|
+
if (config.output !== "server") {
|
|
181
|
+
throw new Error(
|
|
182
|
+
'The option `build.split` can only be used when `output` is set to `"server"`.'
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
179
186
|
}
|
|
180
187
|
/** Stats */
|
|
181
188
|
async printStats({
|