astro 4.12.3 → 4.13.1
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 +21 -104
- package/dist/actions/runtime/middleware.d.ts +1 -0
- package/dist/actions/runtime/middleware.js +35 -24
- package/dist/actions/runtime/route.js +4 -4
- package/dist/actions/runtime/utils.d.ts +2 -0
- package/dist/actions/runtime/virtual/client.d.ts +0 -1
- package/dist/actions/runtime/virtual/client.js +0 -4
- package/dist/actions/runtime/virtual/server.d.ts +1 -4
- package/dist/actions/runtime/virtual/server.js +20 -13
- package/dist/actions/utils.d.ts +1 -0
- package/dist/actions/utils.js +12 -0
- package/dist/cli/add/index.d.ts +0 -7
- package/dist/cli/add/index.js +1 -2
- package/dist/cli/install-package.d.ts +0 -1
- package/dist/cli/install-package.js +1 -2
- package/dist/container/index.js +0 -1
- package/dist/content/runtime-assets.d.ts +2 -2
- package/dist/content/types-generator.js +5 -3
- package/dist/content/utils.d.ts +2 -11
- package/dist/content/utils.js +0 -8
- package/dist/core/app/types.d.ts +0 -1
- package/dist/core/build/generate.d.ts +0 -4
- package/dist/core/build/generate.js +10 -24
- package/dist/core/build/index.js +1 -1
- package/dist/core/build/internal.d.ts +0 -18
- package/dist/core/build/internal.js +0 -17
- package/dist/core/build/page-data.d.ts +1 -1
- package/dist/core/build/page-data.js +1 -18
- package/dist/core/build/plugins/plugin-analyzer.js +0 -4
- package/dist/core/build/plugins/plugin-internals.js +0 -7
- package/dist/core/build/plugins/plugin-manifest.d.ts +0 -10
- package/dist/core/build/plugins/plugin-manifest.js +0 -3
- package/dist/core/build/plugins/plugin-ssr.js +0 -1
- package/dist/core/build/types.d.ts +1 -8
- package/dist/core/compile/index.d.ts +0 -1
- package/dist/core/compile/types.d.ts +0 -7
- package/dist/core/config/schema.d.ts +0 -34
- package/dist/core/config/schema.js +0 -4
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/dev/restart.d.ts +0 -2
- package/dist/core/dev/restart.js +1 -3
- package/dist/core/errors/dev/vite.d.ts +0 -13
- package/dist/core/errors/dev/vite.js +1 -2
- package/dist/core/errors/errors-data.d.ts +18 -6
- package/dist/core/errors/errors-data.js +13 -6
- package/dist/core/fs/index.d.ts +0 -2
- package/dist/core/fs/index.js +0 -5
- package/dist/core/logger/core.d.ts +0 -1
- package/dist/core/logger/core.js +0 -18
- package/dist/core/messages.d.ts +0 -1
- package/dist/core/messages.js +2 -3
- package/dist/core/middleware/callMiddleware.d.ts +1 -2
- package/dist/core/middleware/callMiddleware.js +2 -12
- package/dist/core/middleware/index.js +3 -2
- package/dist/core/render/ssr-element.d.ts +0 -1
- package/dist/core/render/ssr-element.js +0 -6
- package/dist/core/render-context.d.ts +1 -1
- package/dist/core/render-context.js +15 -39
- package/dist/core/util.d.ts +0 -2
- package/dist/core/util.js +0 -14
- package/dist/preferences/index.d.ts +0 -1
- package/dist/preferences/index.js +0 -1
- package/dist/runtime/server/render/component.d.ts +0 -3
- package/dist/vite-plugin-astro-server/controller.d.ts +0 -4
- package/dist/vite-plugin-astro-server/controller.js +0 -2
- package/dist/vite-plugin-astro-server/plugin.js +0 -1
- package/package.json +19 -25
- package/templates/actions.mjs +8 -5
- package/dist/actions/runtime/store.d.ts +0 -5
- package/dist/actions/runtime/store.js +0 -18
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import os from "node:os";
|
|
3
|
-
import {
|
|
4
|
-
import { bgGreen, black, blue, bold, dim, green, magenta } from "kleur/colors";
|
|
3
|
+
import { bgGreen, black, blue, bold, dim, green, magenta, red } from "kleur/colors";
|
|
5
4
|
import PQueue from "p-queue";
|
|
6
5
|
import {
|
|
7
6
|
generateImagesForPath,
|
|
@@ -12,7 +11,6 @@ import { hasPrerenderedPages } from "../../core/build/internal.js";
|
|
|
12
11
|
import {
|
|
13
12
|
isRelativePath,
|
|
14
13
|
joinPaths,
|
|
15
|
-
prependForwardSlash,
|
|
16
14
|
removeLeadingForwardSlash,
|
|
17
15
|
removeTrailingForwardSlash
|
|
18
16
|
} from "../../core/path.js";
|
|
@@ -35,22 +33,6 @@ import { getTimeStat, shouldAppendForwardSlash } from "./util.js";
|
|
|
35
33
|
function createEntryURL(filePath, outFolder) {
|
|
36
34
|
return new URL("./" + filePath + `?time=${Date.now()}`, outFolder);
|
|
37
35
|
}
|
|
38
|
-
function rootRelativeFacadeId(facadeId, settings) {
|
|
39
|
-
return facadeId.slice(fileURLToPath(settings.config.root).length);
|
|
40
|
-
}
|
|
41
|
-
function chunkIsPage(settings, output, internals) {
|
|
42
|
-
if (output.type !== "chunk") {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
const chunk = output;
|
|
46
|
-
if (chunk.facadeModuleId) {
|
|
47
|
-
const facadeToEntryId = prependForwardSlash(
|
|
48
|
-
rootRelativeFacadeId(chunk.facadeModuleId, settings)
|
|
49
|
-
);
|
|
50
|
-
return internals.entrySpecifierToBundleMap.has(facadeToEntryId);
|
|
51
|
-
}
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
36
|
async function generatePages(options, internals) {
|
|
55
37
|
const generatePagesTimer = performance.now();
|
|
56
38
|
const ssr = isServerLikeOutput(options.settings.config);
|
|
@@ -143,6 +125,7 @@ ${bgGreen(black(` ${verb} static routes `))}`);
|
|
|
143
125
|
}
|
|
144
126
|
await runHookBuildGenerated({ config, logger });
|
|
145
127
|
}
|
|
128
|
+
const THRESHOLD_SLOW_RENDER_TIME_MS = 500;
|
|
146
129
|
async function generatePage(pageData, ssrEntry, builtPaths, pipeline) {
|
|
147
130
|
const { config, logger } = pipeline;
|
|
148
131
|
const pageModulePromise = ssrEntry.page;
|
|
@@ -178,7 +161,13 @@ async function generatePage(pageData, ssrEntry, builtPaths, pipeline) {
|
|
|
178
161
|
const timeEnd = performance.now();
|
|
179
162
|
const timeChange = getTimeStat(prevTimeEnd, timeEnd);
|
|
180
163
|
const timeIncrease = `(+${timeChange})`;
|
|
181
|
-
|
|
164
|
+
let timeIncreaseLabel;
|
|
165
|
+
if (timeEnd - prevTimeEnd > THRESHOLD_SLOW_RENDER_TIME_MS) {
|
|
166
|
+
timeIncreaseLabel = red(timeIncrease);
|
|
167
|
+
} else {
|
|
168
|
+
timeIncreaseLabel = dim(timeIncrease);
|
|
169
|
+
}
|
|
170
|
+
logger.info("SKIP_FORMAT", ` ${timeIncreaseLabel}`);
|
|
182
171
|
prevTimeEnd = timeEnd;
|
|
183
172
|
}
|
|
184
173
|
}
|
|
@@ -398,13 +387,10 @@ function createBuildManifest(settings, internals, renderers, middleware) {
|
|
|
398
387
|
i18n: i18nManifest,
|
|
399
388
|
buildFormat: settings.config.build.format,
|
|
400
389
|
middleware,
|
|
401
|
-
rewritingEnabled: settings.config.experimental.rewriting,
|
|
402
390
|
checkOrigin: settings.config.security?.checkOrigin ?? false,
|
|
403
391
|
experimentalEnvGetSecretEnabled: false
|
|
404
392
|
};
|
|
405
393
|
}
|
|
406
394
|
export {
|
|
407
|
-
|
|
408
|
-
generatePages,
|
|
409
|
-
rootRelativeFacadeId
|
|
395
|
+
generatePages
|
|
410
396
|
};
|
package/dist/core/build/index.js
CHANGED
|
@@ -108,7 +108,7 @@ class AstroBuilder {
|
|
|
108
108
|
}
|
|
109
109
|
this.logger.info("build", "Collecting build info...");
|
|
110
110
|
this.timer.loadStart = performance.now();
|
|
111
|
-
const { assets, allPages } =
|
|
111
|
+
const { assets, allPages } = collectPagesData({
|
|
112
112
|
settings: this.settings,
|
|
113
113
|
logger: this.logger,
|
|
114
114
|
manifest: this.manifest
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Rollup } from 'vite';
|
|
2
2
|
import type { RouteData, SSRResult } from '../../@types/astro.js';
|
|
3
|
-
import type { PageOptions } from '../../vite-plugin-astro/types.js';
|
|
4
3
|
import type { PageBuildData, StylesheetAsset, ViteID } from './types.js';
|
|
5
4
|
export interface BuildInternals {
|
|
6
5
|
/**
|
|
@@ -20,18 +19,10 @@ export interface BuildInternals {
|
|
|
20
19
|
*/
|
|
21
20
|
inlinedScripts: Map<string, string>;
|
|
22
21
|
entrySpecifierToBundleMap: Map<string, string>;
|
|
23
|
-
/**
|
|
24
|
-
* A map to get a specific page's bundled output file.
|
|
25
|
-
*/
|
|
26
|
-
pageToBundleMap: Map<string, string>;
|
|
27
22
|
/**
|
|
28
23
|
* A map for page-specific information.
|
|
29
24
|
*/
|
|
30
25
|
pagesByKeys: Map<string, PageBuildData>;
|
|
31
|
-
/**
|
|
32
|
-
* A map for page-specific output.
|
|
33
|
-
*/
|
|
34
|
-
pageOptionsByPage: Map<string, PageOptions>;
|
|
35
26
|
/**
|
|
36
27
|
* A map for page-specific information by Vite ID (a path-like string)
|
|
37
28
|
*/
|
|
@@ -86,7 +77,6 @@ export interface BuildInternals {
|
|
|
86
77
|
manifestEntryChunk?: Rollup.OutputChunk;
|
|
87
78
|
manifestFileName?: string;
|
|
88
79
|
entryPoints: Map<RouteData, URL>;
|
|
89
|
-
ssrSplitEntryChunks: Map<string, Rollup.OutputChunk>;
|
|
90
80
|
componentMetadata: SSRResult['componentMetadata'];
|
|
91
81
|
middlewareEntryPoint?: URL;
|
|
92
82
|
/**
|
|
@@ -108,7 +98,6 @@ export declare function trackClientOnlyPageDatas(internals: BuildInternals, page
|
|
|
108
98
|
* Tracks scripts to the pages they are associated with. (experimental.directRenderScript)
|
|
109
99
|
*/
|
|
110
100
|
export declare function trackScriptPageDatas(internals: BuildInternals, pageData: PageBuildData, scriptIds: string[]): void;
|
|
111
|
-
export declare function getPageDatasByChunk(internals: BuildInternals, chunk: Rollup.RenderedChunk): Generator<PageBuildData, void, unknown>;
|
|
112
101
|
export declare function getPageDatasByClientOnlyID(internals: BuildInternals, viteid: ViteID): Generator<PageBuildData, void, unknown>;
|
|
113
102
|
/**
|
|
114
103
|
* From its route and component, get the page data from the build internals.
|
|
@@ -117,12 +106,6 @@ export declare function getPageDatasByClientOnlyID(internals: BuildInternals, vi
|
|
|
117
106
|
* @param component The component of the page, used to identify the page
|
|
118
107
|
*/
|
|
119
108
|
export declare function getPageData(internals: BuildInternals, route: string, component: string): PageBuildData | undefined;
|
|
120
|
-
/**
|
|
121
|
-
* Get all pages datas from the build internals, using a specific component.
|
|
122
|
-
* @param internals Build Internals with all the pages
|
|
123
|
-
* @param component path to the component, used to identify related pages
|
|
124
|
-
*/
|
|
125
|
-
export declare function getPagesDatasByComponent(internals: BuildInternals, component: string): PageBuildData[];
|
|
126
109
|
/**
|
|
127
110
|
* Map internals.pagesByKeys to a new map with the public key instead of the internal key.
|
|
128
111
|
* This function is only used to avoid breaking changes in the Integrations API, after we changed the way
|
|
@@ -134,7 +117,6 @@ export declare function getPagesDatasByComponent(internals: BuildInternals, comp
|
|
|
134
117
|
*/
|
|
135
118
|
export declare function getPageDatasWithPublicKey(pagesByKeys: Map<string, PageBuildData>): Map<string, PageBuildData>;
|
|
136
119
|
export declare function getPageDataByViteID(internals: BuildInternals, viteid: ViteID): PageBuildData | undefined;
|
|
137
|
-
export declare function hasPageDataByViteID(internals: BuildInternals, viteid: ViteID): boolean;
|
|
138
120
|
export declare function hasPrerenderedPages(internals: BuildInternals): boolean;
|
|
139
121
|
interface OrderInfo {
|
|
140
122
|
depth: number;
|
|
@@ -11,9 +11,7 @@ function createBuildInternals() {
|
|
|
11
11
|
hoistedScriptIdToPagesMap,
|
|
12
12
|
inlinedScripts: /* @__PURE__ */ new Map(),
|
|
13
13
|
entrySpecifierToBundleMap: /* @__PURE__ */ new Map(),
|
|
14
|
-
pageToBundleMap: /* @__PURE__ */ new Map(),
|
|
15
14
|
pagesByKeys: /* @__PURE__ */ new Map(),
|
|
16
|
-
pageOptionsByPage: /* @__PURE__ */ new Map(),
|
|
17
15
|
pagesByViteID: /* @__PURE__ */ new Map(),
|
|
18
16
|
pagesByClientOnly: /* @__PURE__ */ new Map(),
|
|
19
17
|
pagesByScriptId: /* @__PURE__ */ new Map(),
|
|
@@ -24,7 +22,6 @@ function createBuildInternals() {
|
|
|
24
22
|
discoveredScripts: /* @__PURE__ */ new Set(),
|
|
25
23
|
staticFiles: /* @__PURE__ */ new Set(),
|
|
26
24
|
componentMetadata: /* @__PURE__ */ new Map(),
|
|
27
|
-
ssrSplitEntryChunks: /* @__PURE__ */ new Map(),
|
|
28
25
|
entryPoints: /* @__PURE__ */ new Map(),
|
|
29
26
|
cacheManifestUsed: false,
|
|
30
27
|
prerenderOnlyChunks: []
|
|
@@ -59,14 +56,6 @@ function trackScriptPageDatas(internals, pageData, scriptIds) {
|
|
|
59
56
|
pageDataSet.add(pageData);
|
|
60
57
|
}
|
|
61
58
|
}
|
|
62
|
-
function* getPageDatasByChunk(internals, chunk) {
|
|
63
|
-
const pagesByViteID = internals.pagesByViteID;
|
|
64
|
-
for (const [modulePath] of Object.entries(chunk.modules)) {
|
|
65
|
-
if (pagesByViteID.has(modulePath)) {
|
|
66
|
-
yield pagesByViteID.get(modulePath);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
59
|
function* getPageDatasByClientOnlyID(internals, viteid) {
|
|
71
60
|
const pagesByClientOnly = internals.pagesByClientOnly;
|
|
72
61
|
if (pagesByClientOnly.size) {
|
|
@@ -125,9 +114,6 @@ function getPageDataByViteID(internals, viteid) {
|
|
|
125
114
|
}
|
|
126
115
|
return void 0;
|
|
127
116
|
}
|
|
128
|
-
function hasPageDataByViteID(internals, viteid) {
|
|
129
|
-
return internals.pagesByViteID.has(viteid);
|
|
130
|
-
}
|
|
131
117
|
function hasPrerenderedPages(internals) {
|
|
132
118
|
for (const pageData of internals.pagesByKeys.values()) {
|
|
133
119
|
if (pageData.route.prerender) {
|
|
@@ -185,12 +171,9 @@ export {
|
|
|
185
171
|
cssOrder,
|
|
186
172
|
getPageData,
|
|
187
173
|
getPageDataByViteID,
|
|
188
|
-
getPageDatasByChunk,
|
|
189
174
|
getPageDatasByClientOnlyID,
|
|
190
175
|
getPageDatasByHoistedScriptId,
|
|
191
176
|
getPageDatasWithPublicKey,
|
|
192
|
-
getPagesDatasByComponent,
|
|
193
|
-
hasPageDataByViteID,
|
|
194
177
|
hasPrerenderedPages,
|
|
195
178
|
mergeInlineCss,
|
|
196
179
|
trackClientOnlyPageDatas,
|
|
@@ -10,4 +10,4 @@ export interface CollectPagesDataResult {
|
|
|
10
10
|
assets: Record<string, string>;
|
|
11
11
|
allPages: AllPagesData;
|
|
12
12
|
}
|
|
13
|
-
export declare function collectPagesData(opts: CollectPagesDataOptions):
|
|
13
|
+
export declare function collectPagesData(opts: CollectPagesDataOptions): CollectPagesDataResult;
|
|
@@ -1,28 +1,13 @@
|
|
|
1
1
|
import * as colors from "kleur/colors";
|
|
2
2
|
import { debug } from "../logger/core.js";
|
|
3
3
|
import { makePageDataKey } from "./plugins/util.js";
|
|
4
|
-
|
|
4
|
+
function collectPagesData(opts) {
|
|
5
5
|
const { settings, manifest } = opts;
|
|
6
6
|
const assets = {};
|
|
7
7
|
const allPages = {};
|
|
8
|
-
const builtPaths = /* @__PURE__ */ new Set();
|
|
9
|
-
const dataCollectionLogTimeout = setInterval(() => {
|
|
10
|
-
opts.logger.info("build", "The data collection step may take longer for larger projects...");
|
|
11
|
-
clearInterval(dataCollectionLogTimeout);
|
|
12
|
-
}, 3e4);
|
|
13
8
|
for (const route of manifest.routes) {
|
|
14
9
|
const key = makePageDataKey(route.route, route.component);
|
|
15
10
|
if (route.pathname) {
|
|
16
|
-
const routeCollectionLogTimeout = setInterval(() => {
|
|
17
|
-
opts.logger.info(
|
|
18
|
-
"build",
|
|
19
|
-
`${colors.bold(
|
|
20
|
-
route.component
|
|
21
|
-
)} is taking a bit longer to import. This is common for larger "Astro.glob(...)" or "import.meta.glob(...)" calls, for instance. Hang tight!`
|
|
22
|
-
);
|
|
23
|
-
clearInterval(routeCollectionLogTimeout);
|
|
24
|
-
}, 1e4);
|
|
25
|
-
builtPaths.add(route.pathname);
|
|
26
11
|
allPages[key] = {
|
|
27
12
|
key,
|
|
28
13
|
component: route.component,
|
|
@@ -31,7 +16,6 @@ async function collectPagesData(opts) {
|
|
|
31
16
|
styles: [],
|
|
32
17
|
hoistedScript: void 0
|
|
33
18
|
};
|
|
34
|
-
clearInterval(routeCollectionLogTimeout);
|
|
35
19
|
if (settings.config.output === "static") {
|
|
36
20
|
const html = `${route.pathname}`.replace(/\/?$/, "/index.html");
|
|
37
21
|
debug(
|
|
@@ -52,7 +36,6 @@ async function collectPagesData(opts) {
|
|
|
52
36
|
hoistedScript: void 0
|
|
53
37
|
};
|
|
54
38
|
}
|
|
55
|
-
clearInterval(dataCollectionLogTimeout);
|
|
56
39
|
return { assets, allPages };
|
|
57
40
|
}
|
|
58
41
|
export {
|
|
@@ -94,10 +94,6 @@ function vitePluginAnalyzer(options, internals) {
|
|
|
94
94
|
const info = this.getModuleInfo(id);
|
|
95
95
|
if (!info?.meta?.astro) continue;
|
|
96
96
|
const astro = info.meta.astro;
|
|
97
|
-
const pageData = getPageDataByViteID(internals, id);
|
|
98
|
-
if (pageData) {
|
|
99
|
-
internals.pageOptionsByPage.set(id, astro.pageOptions);
|
|
100
|
-
}
|
|
101
97
|
for (const c of astro.hydratedComponents) {
|
|
102
98
|
const rid = c.resolvedPath ? decodeURI(c.resolvedPath) : c.specifier;
|
|
103
99
|
if (internals.discoveredHydratedComponents.has(rid)) {
|
|
@@ -41,13 +41,6 @@ function vitePluginInternals(input, internals) {
|
|
|
41
41
|
for (const specifier of specifiers) {
|
|
42
42
|
internals.entrySpecifierToBundleMap.set(normalizeEntryId(specifier), chunk.fileName);
|
|
43
43
|
}
|
|
44
|
-
} else if (chunk.type === "chunk") {
|
|
45
|
-
for (const id of Object.keys(chunk.modules)) {
|
|
46
|
-
const pageData = internals.pagesByViteID.get(id);
|
|
47
|
-
if (pageData) {
|
|
48
|
-
internals.pageToBundleMap.set(pageData.moduleSpecifier, chunk.fileName);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
44
|
}
|
|
52
45
|
}
|
|
53
46
|
}
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import type { OutputChunk } from 'rollup';
|
|
2
|
-
import type { SerializedSSRManifest } from '../../app/types.js';
|
|
3
1
|
import { type BuildInternals } from '../internal.js';
|
|
4
2
|
import type { AstroBuildPlugin } from '../plugin.js';
|
|
5
3
|
import type { StaticBuildOptions } from '../types.js';
|
|
6
4
|
export declare const SSR_MANIFEST_VIRTUAL_MODULE_ID = "@astrojs-manifest";
|
|
7
5
|
export declare const RESOLVED_SSR_MANIFEST_VIRTUAL_MODULE_ID: string;
|
|
8
6
|
export declare function pluginManifest(options: StaticBuildOptions, internals: BuildInternals): AstroBuildPlugin;
|
|
9
|
-
export declare function createManifest(buildOpts: StaticBuildOptions, internals: BuildInternals): Promise<SerializedSSRManifest>;
|
|
10
|
-
/**
|
|
11
|
-
* It injects the manifest in the given output rollup chunk. It returns the new emitted code
|
|
12
|
-
* @param buildOpts
|
|
13
|
-
* @param internals
|
|
14
|
-
* @param chunk
|
|
15
|
-
*/
|
|
16
|
-
export declare function injectManifest(manifest: SerializedSSRManifest, chunk: Readonly<OutputChunk>): string;
|
|
@@ -213,7 +213,6 @@ function buildManifest(opts, internals, staticFiles) {
|
|
|
213
213
|
i18n: i18nManifest,
|
|
214
214
|
buildFormat: settings.config.build.format,
|
|
215
215
|
checkOrigin: settings.config.security?.checkOrigin ?? false,
|
|
216
|
-
rewritingEnabled: settings.config.experimental.rewriting,
|
|
217
216
|
serverIslandNameMap: Array.from(settings.serverIslandNameMap),
|
|
218
217
|
experimentalEnvGetSecretEnabled: settings.config.experimental.env !== void 0 && (settings.adapter?.supportedAstroFeatures.envGetSecret ?? "unsupported") !== "unsupported"
|
|
219
218
|
};
|
|
@@ -221,7 +220,5 @@ function buildManifest(opts, internals, staticFiles) {
|
|
|
221
220
|
export {
|
|
222
221
|
RESOLVED_SSR_MANIFEST_VIRTUAL_MODULE_ID,
|
|
223
222
|
SSR_MANIFEST_VIRTUAL_MODULE_ID,
|
|
224
|
-
createManifest,
|
|
225
|
-
injectManifest,
|
|
226
223
|
pluginManifest
|
|
227
224
|
};
|
|
@@ -167,7 +167,6 @@ function vitePluginSSRSplit(internals, adapter, options) {
|
|
|
167
167
|
}
|
|
168
168
|
for (const moduleKey of Object.keys(chunk.modules)) {
|
|
169
169
|
if (moduleKey.startsWith(RESOLVED_SPLIT_MODULE_ID)) {
|
|
170
|
-
internals.ssrSplitEntryChunks.set(moduleKey, chunk);
|
|
171
170
|
storeEntryPoint(moduleKey, options, internals, chunk.fileName);
|
|
172
171
|
}
|
|
173
172
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type * as vite from 'vite';
|
|
2
2
|
import type { InlineConfig } from 'vite';
|
|
3
|
-
import type {
|
|
3
|
+
import type { AstroSettings, ComponentInstance, ManifestData, MiddlewareHandler, RouteData, RuntimeMode, SSRLoadedRenderer } from '../../@types/astro.js';
|
|
4
4
|
import type { Logger } from '../logger/core.js';
|
|
5
5
|
export type ComponentPath = string;
|
|
6
6
|
export type ViteID = string;
|
|
7
|
-
export type PageOutput = AstroConfig['output'];
|
|
8
7
|
export type StylesheetAsset = {
|
|
9
8
|
type: 'inline';
|
|
10
9
|
content: string;
|
|
@@ -51,10 +50,4 @@ export interface SinglePageBuiltModule {
|
|
|
51
50
|
renderers: SSRLoadedRenderer[];
|
|
52
51
|
}
|
|
53
52
|
export type ViteBuildReturn = Awaited<ReturnType<typeof vite.build>>;
|
|
54
|
-
export type RollupOutput = Extract<Extract<ViteBuildReturn, Exclude<ViteBuildReturn, Array<any>>>, {
|
|
55
|
-
output: any;
|
|
56
|
-
}>;
|
|
57
|
-
export type OutputChunk = Extract<RollupOutput['output'][number], {
|
|
58
|
-
type: 'chunk';
|
|
59
|
-
}>;
|
|
60
53
|
export {};
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import type { SourceMap } from 'rollup';
|
|
2
|
-
export type TransformStyleResult = null | {
|
|
3
|
-
code: string;
|
|
4
|
-
map: SourceMap | null;
|
|
5
|
-
deps: Set<string>;
|
|
6
|
-
};
|
|
7
|
-
export type TransformStyle = (source: string, lang: string) => TransformStyleResult | Promise<TransformStyleResult>;
|
|
8
1
|
export interface CompileCssResult {
|
|
9
2
|
code: string;
|
|
10
3
|
/**
|
|
@@ -54,10 +54,8 @@ export declare const ASTRO_CONFIG_DEFAULTS: {
|
|
|
54
54
|
actions: false;
|
|
55
55
|
directRenderScript: false;
|
|
56
56
|
contentCollectionCache: false;
|
|
57
|
-
contentCollectionJsonSchema: false;
|
|
58
57
|
clientPrerender: false;
|
|
59
58
|
globalRoutePriority: false;
|
|
60
|
-
rewriting: false;
|
|
61
59
|
serverIslands: false;
|
|
62
60
|
env: {
|
|
63
61
|
validateSecrets: false;
|
|
@@ -402,10 +400,8 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
402
400
|
actions: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
403
401
|
directRenderScript: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
404
402
|
contentCollectionCache: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
405
|
-
contentCollectionJsonSchema: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
406
403
|
clientPrerender: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
407
404
|
globalRoutePriority: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
408
|
-
rewriting: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
409
405
|
env: z.ZodOptional<z.ZodObject<{
|
|
410
406
|
schema: z.ZodOptional<z.ZodRecord<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, z.ZodIntersection<z.ZodUnion<[z.ZodObject<{
|
|
411
407
|
context: z.ZodLiteral<"client">;
|
|
@@ -621,10 +617,8 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
621
617
|
actions: boolean;
|
|
622
618
|
directRenderScript: boolean;
|
|
623
619
|
contentCollectionCache: boolean;
|
|
624
|
-
contentCollectionJsonSchema: boolean;
|
|
625
620
|
clientPrerender: boolean;
|
|
626
621
|
globalRoutePriority: boolean;
|
|
627
|
-
rewriting: boolean;
|
|
628
622
|
serverIslands: boolean;
|
|
629
623
|
env?: {
|
|
630
624
|
validateSecrets: boolean;
|
|
@@ -672,10 +666,8 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
672
666
|
actions?: boolean | undefined;
|
|
673
667
|
directRenderScript?: boolean | undefined;
|
|
674
668
|
contentCollectionCache?: boolean | undefined;
|
|
675
|
-
contentCollectionJsonSchema?: boolean | undefined;
|
|
676
669
|
clientPrerender?: boolean | undefined;
|
|
677
670
|
globalRoutePriority?: boolean | undefined;
|
|
678
|
-
rewriting?: boolean | undefined;
|
|
679
671
|
serverIslands?: boolean | undefined;
|
|
680
672
|
env?: {
|
|
681
673
|
validateSecrets?: boolean | undefined;
|
|
@@ -801,10 +793,8 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
801
793
|
actions: boolean;
|
|
802
794
|
directRenderScript: boolean;
|
|
803
795
|
contentCollectionCache: boolean;
|
|
804
|
-
contentCollectionJsonSchema: boolean;
|
|
805
796
|
clientPrerender: boolean;
|
|
806
797
|
globalRoutePriority: boolean;
|
|
807
|
-
rewriting: boolean;
|
|
808
798
|
serverIslands: boolean;
|
|
809
799
|
env?: {
|
|
810
800
|
validateSecrets: boolean;
|
|
@@ -966,10 +956,8 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
966
956
|
actions?: boolean | undefined;
|
|
967
957
|
directRenderScript?: boolean | undefined;
|
|
968
958
|
contentCollectionCache?: boolean | undefined;
|
|
969
|
-
contentCollectionJsonSchema?: boolean | undefined;
|
|
970
959
|
clientPrerender?: boolean | undefined;
|
|
971
960
|
globalRoutePriority?: boolean | undefined;
|
|
972
|
-
rewriting?: boolean | undefined;
|
|
973
961
|
serverIslands?: boolean | undefined;
|
|
974
962
|
env?: {
|
|
975
963
|
validateSecrets?: boolean | undefined;
|
|
@@ -1355,10 +1343,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1355
1343
|
actions: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
1356
1344
|
directRenderScript: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
1357
1345
|
contentCollectionCache: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
1358
|
-
contentCollectionJsonSchema: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
1359
1346
|
clientPrerender: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
1360
1347
|
globalRoutePriority: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
1361
|
-
rewriting: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
1362
1348
|
env: z.ZodOptional<z.ZodObject<{
|
|
1363
1349
|
schema: z.ZodOptional<z.ZodRecord<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, z.ZodIntersection<z.ZodUnion<[z.ZodObject<{
|
|
1364
1350
|
context: z.ZodLiteral<"client">;
|
|
@@ -1574,10 +1560,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1574
1560
|
actions: boolean;
|
|
1575
1561
|
directRenderScript: boolean;
|
|
1576
1562
|
contentCollectionCache: boolean;
|
|
1577
|
-
contentCollectionJsonSchema: boolean;
|
|
1578
1563
|
clientPrerender: boolean;
|
|
1579
1564
|
globalRoutePriority: boolean;
|
|
1580
|
-
rewriting: boolean;
|
|
1581
1565
|
serverIslands: boolean;
|
|
1582
1566
|
env?: {
|
|
1583
1567
|
validateSecrets: boolean;
|
|
@@ -1625,10 +1609,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1625
1609
|
actions?: boolean | undefined;
|
|
1626
1610
|
directRenderScript?: boolean | undefined;
|
|
1627
1611
|
contentCollectionCache?: boolean | undefined;
|
|
1628
|
-
contentCollectionJsonSchema?: boolean | undefined;
|
|
1629
1612
|
clientPrerender?: boolean | undefined;
|
|
1630
1613
|
globalRoutePriority?: boolean | undefined;
|
|
1631
|
-
rewriting?: boolean | undefined;
|
|
1632
1614
|
serverIslands?: boolean | undefined;
|
|
1633
1615
|
env?: {
|
|
1634
1616
|
validateSecrets?: boolean | undefined;
|
|
@@ -1829,10 +1811,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1829
1811
|
actions: boolean;
|
|
1830
1812
|
directRenderScript: boolean;
|
|
1831
1813
|
contentCollectionCache: boolean;
|
|
1832
|
-
contentCollectionJsonSchema: boolean;
|
|
1833
1814
|
clientPrerender: boolean;
|
|
1834
1815
|
globalRoutePriority: boolean;
|
|
1835
|
-
rewriting: boolean;
|
|
1836
1816
|
serverIslands: boolean;
|
|
1837
1817
|
env?: {
|
|
1838
1818
|
validateSecrets: boolean;
|
|
@@ -1994,10 +1974,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1994
1974
|
actions?: boolean | undefined;
|
|
1995
1975
|
directRenderScript?: boolean | undefined;
|
|
1996
1976
|
contentCollectionCache?: boolean | undefined;
|
|
1997
|
-
contentCollectionJsonSchema?: boolean | undefined;
|
|
1998
1977
|
clientPrerender?: boolean | undefined;
|
|
1999
1978
|
globalRoutePriority?: boolean | undefined;
|
|
2000
|
-
rewriting?: boolean | undefined;
|
|
2001
1979
|
serverIslands?: boolean | undefined;
|
|
2002
1980
|
env?: {
|
|
2003
1981
|
validateSecrets?: boolean | undefined;
|
|
@@ -2124,10 +2102,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2124
2102
|
actions: boolean;
|
|
2125
2103
|
directRenderScript: boolean;
|
|
2126
2104
|
contentCollectionCache: boolean;
|
|
2127
|
-
contentCollectionJsonSchema: boolean;
|
|
2128
2105
|
clientPrerender: boolean;
|
|
2129
2106
|
globalRoutePriority: boolean;
|
|
2130
|
-
rewriting: boolean;
|
|
2131
2107
|
serverIslands: boolean;
|
|
2132
2108
|
env?: {
|
|
2133
2109
|
validateSecrets: boolean;
|
|
@@ -2289,10 +2265,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2289
2265
|
actions?: boolean | undefined;
|
|
2290
2266
|
directRenderScript?: boolean | undefined;
|
|
2291
2267
|
contentCollectionCache?: boolean | undefined;
|
|
2292
|
-
contentCollectionJsonSchema?: boolean | undefined;
|
|
2293
2268
|
clientPrerender?: boolean | undefined;
|
|
2294
2269
|
globalRoutePriority?: boolean | undefined;
|
|
2295
|
-
rewriting?: boolean | undefined;
|
|
2296
2270
|
serverIslands?: boolean | undefined;
|
|
2297
2271
|
env?: {
|
|
2298
2272
|
validateSecrets?: boolean | undefined;
|
|
@@ -2419,10 +2393,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2419
2393
|
actions: boolean;
|
|
2420
2394
|
directRenderScript: boolean;
|
|
2421
2395
|
contentCollectionCache: boolean;
|
|
2422
|
-
contentCollectionJsonSchema: boolean;
|
|
2423
2396
|
clientPrerender: boolean;
|
|
2424
2397
|
globalRoutePriority: boolean;
|
|
2425
|
-
rewriting: boolean;
|
|
2426
2398
|
serverIslands: boolean;
|
|
2427
2399
|
env?: {
|
|
2428
2400
|
validateSecrets: boolean;
|
|
@@ -2584,10 +2556,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2584
2556
|
actions?: boolean | undefined;
|
|
2585
2557
|
directRenderScript?: boolean | undefined;
|
|
2586
2558
|
contentCollectionCache?: boolean | undefined;
|
|
2587
|
-
contentCollectionJsonSchema?: boolean | undefined;
|
|
2588
2559
|
clientPrerender?: boolean | undefined;
|
|
2589
2560
|
globalRoutePriority?: boolean | undefined;
|
|
2590
|
-
rewriting?: boolean | undefined;
|
|
2591
2561
|
serverIslands?: boolean | undefined;
|
|
2592
2562
|
env?: {
|
|
2593
2563
|
validateSecrets?: boolean | undefined;
|
|
@@ -2714,10 +2684,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2714
2684
|
actions: boolean;
|
|
2715
2685
|
directRenderScript: boolean;
|
|
2716
2686
|
contentCollectionCache: boolean;
|
|
2717
|
-
contentCollectionJsonSchema: boolean;
|
|
2718
2687
|
clientPrerender: boolean;
|
|
2719
2688
|
globalRoutePriority: boolean;
|
|
2720
|
-
rewriting: boolean;
|
|
2721
2689
|
serverIslands: boolean;
|
|
2722
2690
|
env?: {
|
|
2723
2691
|
validateSecrets: boolean;
|
|
@@ -2879,10 +2847,8 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2879
2847
|
actions?: boolean | undefined;
|
|
2880
2848
|
directRenderScript?: boolean | undefined;
|
|
2881
2849
|
contentCollectionCache?: boolean | undefined;
|
|
2882
|
-
contentCollectionJsonSchema?: boolean | undefined;
|
|
2883
2850
|
clientPrerender?: boolean | undefined;
|
|
2884
2851
|
globalRoutePriority?: boolean | undefined;
|
|
2885
|
-
rewriting?: boolean | undefined;
|
|
2886
2852
|
serverIslands?: boolean | undefined;
|
|
2887
2853
|
env?: {
|
|
2888
2854
|
validateSecrets?: boolean | undefined;
|
|
@@ -44,10 +44,8 @@ const ASTRO_CONFIG_DEFAULTS = {
|
|
|
44
44
|
actions: false,
|
|
45
45
|
directRenderScript: false,
|
|
46
46
|
contentCollectionCache: false,
|
|
47
|
-
contentCollectionJsonSchema: false,
|
|
48
47
|
clientPrerender: false,
|
|
49
48
|
globalRoutePriority: false,
|
|
50
|
-
rewriting: false,
|
|
51
49
|
serverIslands: false,
|
|
52
50
|
env: {
|
|
53
51
|
validateSecrets: false
|
|
@@ -328,10 +326,8 @@ const AstroConfigSchema = z.object({
|
|
|
328
326
|
actions: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.actions),
|
|
329
327
|
directRenderScript: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.directRenderScript),
|
|
330
328
|
contentCollectionCache: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.contentCollectionCache),
|
|
331
|
-
contentCollectionJsonSchema: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.contentCollectionJsonSchema),
|
|
332
329
|
clientPrerender: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.clientPrerender),
|
|
333
330
|
globalRoutePriority: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.globalRoutePriority),
|
|
334
|
-
rewriting: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.rewriting),
|
|
335
331
|
env: z.object({
|
|
336
332
|
schema: EnvSchema.optional(),
|
|
337
333
|
validateSecrets: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.env.validateSecrets)
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -19,7 +19,7 @@ async function dev(inlineConfig) {
|
|
|
19
19
|
await telemetry.record([]);
|
|
20
20
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
21
21
|
const logger = restart.container.logger;
|
|
22
|
-
const currentVersion = "4.
|
|
22
|
+
const currentVersion = "4.13.1";
|
|
23
23
|
const isPrerelease = currentVersion.includes("-");
|
|
24
24
|
if (!isPrerelease) {
|
|
25
25
|
try {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type nodeFs from 'node:fs';
|
|
2
2
|
import type { AstroInlineConfig } from '../../@types/astro.js';
|
|
3
3
|
import type { Container } from './container.js';
|
|
4
|
-
export declare function shouldRestartContainer({ settings, inlineConfig, restartInFlight }: Container, changedFile: string): boolean;
|
|
5
|
-
export declare function restartContainer(container: Container): Promise<Container | Error>;
|
|
6
4
|
export interface CreateContainerWithAutomaticRestart {
|
|
7
5
|
inlineConfig?: AstroInlineConfig;
|
|
8
6
|
fs: typeof nodeFs;
|
package/dist/core/dev/restart.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ShikiTransformer } from 'shiki';
|
|
2
1
|
import type { ErrorPayload } from 'vite';
|
|
3
2
|
import type { ModuleLoader } from '../../module-loader/index.js';
|
|
4
3
|
import { type ErrorWithMetadata } from '../errors.js';
|
|
@@ -29,15 +28,3 @@ export interface AstroErrorPayload {
|
|
|
29
28
|
* Generate a payload for Vite's error overlay
|
|
30
29
|
*/
|
|
31
30
|
export declare function getViteErrorPayload(err: ErrorWithMetadata): Promise<AstroErrorPayload>;
|
|
32
|
-
/**
|
|
33
|
-
* Transformer for `shiki`'s legacy `lineOptions`, allows to add classes to specific lines
|
|
34
|
-
* FROM: https://github.com/shikijs/shiki/blob/4a58472070a9a359a4deafec23bb576a73e24c6a/packages/transformers/src/transformers/compact-line-options.ts
|
|
35
|
-
* LICENSE: https://github.com/shikijs/shiki/blob/4a58472070a9a359a4deafec23bb576a73e24c6a/LICENSE
|
|
36
|
-
*/
|
|
37
|
-
export declare function transformerCompactLineOptions(lineOptions?: {
|
|
38
|
-
/**
|
|
39
|
-
* 1-based line number.
|
|
40
|
-
*/
|
|
41
|
-
line: number;
|
|
42
|
-
classes?: string[];
|
|
43
|
-
}[]): ShikiTransformer;
|