astro 4.13.0 → 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 -2
- 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/content/runtime-assets.d.ts +1 -1
- package/dist/content/utils.d.ts +2 -11
- package/dist/content/utils.js +0 -8
- package/dist/core/build/generate.d.ts +0 -4
- package/dist/core/build/generate.js +1 -21
- 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 -2
- 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/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 +16 -5
- 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/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 +4 -2
- 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/package.json +1 -7
- package/templates/actions.mjs +8 -5
- package/dist/actions/runtime/store.d.ts +0 -5
- package/dist/actions/runtime/store.js +0 -18
|
@@ -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;
|
|
@@ -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
|
/**
|
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.13.
|
|
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;
|
|
@@ -1427,6 +1427,19 @@ export declare const DuplicateContentEntrySlugError: {
|
|
|
1427
1427
|
title: string;
|
|
1428
1428
|
message(collection: string, slug: string, preExisting: string, alsoFound: string): string;
|
|
1429
1429
|
};
|
|
1430
|
+
/**
|
|
1431
|
+
* @docs
|
|
1432
|
+
* @see
|
|
1433
|
+
* - [devalue library](https://github.com/rich-harris/devalue)
|
|
1434
|
+
* @description
|
|
1435
|
+
* `transform()` functions in your content config must return valid JSON, or data types compatible with the devalue library (including Dates, Maps, and Sets).
|
|
1436
|
+
*/
|
|
1437
|
+
export declare const UnsupportedConfigTransformError: {
|
|
1438
|
+
name: string;
|
|
1439
|
+
title: string;
|
|
1440
|
+
message: (parseError: string) => string;
|
|
1441
|
+
hint: string;
|
|
1442
|
+
};
|
|
1430
1443
|
/**
|
|
1431
1444
|
* @docs
|
|
1432
1445
|
* @see
|
|
@@ -1468,15 +1481,13 @@ export declare const ActionQueryStringInvalidError: {
|
|
|
1468
1481
|
};
|
|
1469
1482
|
/**
|
|
1470
1483
|
* @docs
|
|
1471
|
-
* @see
|
|
1472
|
-
* - [devalue library](https://github.com/rich-harris/devalue)
|
|
1473
1484
|
* @description
|
|
1474
|
-
*
|
|
1485
|
+
* Action called from a server page or endpoint without using `Astro.callAction()`.
|
|
1475
1486
|
*/
|
|
1476
|
-
export declare const
|
|
1487
|
+
export declare const ActionCalledFromServerError: {
|
|
1477
1488
|
name: string;
|
|
1478
1489
|
title: string;
|
|
1479
|
-
message:
|
|
1490
|
+
message: string;
|
|
1480
1491
|
hint: string;
|
|
1481
1492
|
};
|
|
1482
1493
|
export declare const UnknownError: {
|
|
@@ -541,6 +541,13 @@ Entries:
|
|
|
541
541
|
- ${alsoFound}`;
|
|
542
542
|
}
|
|
543
543
|
};
|
|
544
|
+
const UnsupportedConfigTransformError = {
|
|
545
|
+
name: "UnsupportedConfigTransformError",
|
|
546
|
+
title: "Unsupported transform in content config.",
|
|
547
|
+
message: (parseError) => `\`transform()\` functions in your content config must return valid JSON, or data types compatible with the devalue library (including Dates, Maps, and Sets).
|
|
548
|
+
Full error: ${parseError}`,
|
|
549
|
+
hint: "See the devalue library for all supported types: https://github.com/rich-harris/devalue"
|
|
550
|
+
};
|
|
544
551
|
const ActionsWithoutServerOutputError = {
|
|
545
552
|
name: "ActionsWithoutServerOutputError",
|
|
546
553
|
title: "Actions must be used with server output.",
|
|
@@ -559,15 +566,15 @@ const ActionQueryStringInvalidError = {
|
|
|
559
566
|
message: (actionName) => `The server received the query string \`?_astroAction=${actionName}\`, but could not find an action with that name. If you changed an action's name in development, remove this query param from your URL and refresh.`,
|
|
560
567
|
hint: "Actions are experimental. Visit the RFC for usage instructions: https://github.com/withastro/roadmap/blob/actions/proposals/0046-actions.md"
|
|
561
568
|
};
|
|
562
|
-
const
|
|
563
|
-
name: "
|
|
564
|
-
title: "
|
|
565
|
-
message:
|
|
566
|
-
|
|
567
|
-
hint: "See the devalue library for all supported types: https://github.com/rich-harris/devalue"
|
|
569
|
+
const ActionCalledFromServerError = {
|
|
570
|
+
name: "ActionCalledFromServerError",
|
|
571
|
+
title: "Action unexpected called from the server.",
|
|
572
|
+
message: "Action called from a server page or endpoint without using `Astro.callAction()`.",
|
|
573
|
+
hint: "See the RFC section on server calls for usage instructions: https://github.com/withastro/roadmap/blob/actions/proposals/0046-actions.md#call-actions-directly-from-server-code"
|
|
568
574
|
};
|
|
569
575
|
const UnknownError = { name: "UnknownError", title: "Unknown Error." };
|
|
570
576
|
export {
|
|
577
|
+
ActionCalledFromServerError,
|
|
571
578
|
ActionQueryStringInvalidError,
|
|
572
579
|
ActionsUsedWithForGetError,
|
|
573
580
|
ActionsWithoutServerOutputError,
|
package/dist/core/fs/index.d.ts
CHANGED
package/dist/core/fs/index.js
CHANGED
|
@@ -3,10 +3,6 @@ import path from "node:path";
|
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import { appendForwardSlash } from "../path.js";
|
|
5
5
|
const isWindows = process.platform === "win32";
|
|
6
|
-
function removeDir(_dir) {
|
|
7
|
-
const dir = fileURLToPath(_dir);
|
|
8
|
-
fs.rmSync(dir, { recursive: true, force: true, maxRetries: 3 });
|
|
9
|
-
}
|
|
10
6
|
function removeEmptyDirs(root) {
|
|
11
7
|
const dir = fileURLToPath(root);
|
|
12
8
|
if (!fs.statSync(dir).isDirectory()) return;
|
|
@@ -90,6 +86,5 @@ const fixWinEPERMSync = (p, options, er) => {
|
|
|
90
86
|
};
|
|
91
87
|
export {
|
|
92
88
|
emptyDir,
|
|
93
|
-
removeDir,
|
|
94
89
|
removeEmptyDirs
|
|
95
90
|
};
|
|
@@ -38,7 +38,6 @@ export declare function debug(...args: any[]): void;
|
|
|
38
38
|
* with colors. This is shared across different loggers, so it's defined here.
|
|
39
39
|
*/
|
|
40
40
|
export declare function getEventPrefix({ level, label }: LogMessage): string;
|
|
41
|
-
export declare let defaultLogLevel: LoggerLevel;
|
|
42
41
|
/** Print out a timer message for debug() */
|
|
43
42
|
export declare function timerMessage(message: string, startTime?: number): string;
|
|
44
43
|
export declare class Logger {
|
package/dist/core/logger/core.js
CHANGED
|
@@ -81,23 +81,6 @@ function getEventPrefix({ level, label }) {
|
|
|
81
81
|
}
|
|
82
82
|
return dim(prefix[0]) + " " + blue(prefix.splice(1).join(" "));
|
|
83
83
|
}
|
|
84
|
-
let defaultLogLevel;
|
|
85
|
-
if (typeof process !== "undefined") {
|
|
86
|
-
let proc = process;
|
|
87
|
-
if ("argv" in proc && Array.isArray(proc.argv)) {
|
|
88
|
-
if (proc.argv.includes("--verbose")) {
|
|
89
|
-
defaultLogLevel = "debug";
|
|
90
|
-
} else if (proc.argv.includes("--silent")) {
|
|
91
|
-
defaultLogLevel = "silent";
|
|
92
|
-
} else {
|
|
93
|
-
defaultLogLevel = "info";
|
|
94
|
-
}
|
|
95
|
-
} else {
|
|
96
|
-
defaultLogLevel = "info";
|
|
97
|
-
}
|
|
98
|
-
} else {
|
|
99
|
-
defaultLogLevel = "info";
|
|
100
|
-
}
|
|
101
84
|
function timerMessage(message, startTime = Date.now()) {
|
|
102
85
|
let timeDiff = Date.now() - startTime;
|
|
103
86
|
let timeDisplay = timeDiff < 750 ? `${Math.round(timeDiff)}ms` : `${(timeDiff / 1e3).toFixed(1)}s`;
|
|
@@ -158,7 +141,6 @@ export {
|
|
|
158
141
|
Logger,
|
|
159
142
|
dateTimeFormat,
|
|
160
143
|
debug,
|
|
161
|
-
defaultLogLevel,
|
|
162
144
|
error,
|
|
163
145
|
getEventPrefix,
|
|
164
146
|
info,
|
package/dist/core/messages.d.ts
CHANGED
|
@@ -45,7 +45,6 @@ export declare function prerelease({ currentVersion }: {
|
|
|
45
45
|
export declare function success(message: string, tip?: string): string;
|
|
46
46
|
export declare function failure(message: string, tip?: string): string;
|
|
47
47
|
export declare function cancelled(message: string, tip?: string): string;
|
|
48
|
-
export declare function getNetworkLogging(host: string | boolean): 'none' | 'host-to-expose' | 'visible';
|
|
49
48
|
export declare function formatConfigErrorMessage(err: ZodError): string;
|
|
50
49
|
export declare function formatErrorMessage(err: ErrorWithMetadata, showFullStacktrace: boolean): string;
|
|
51
50
|
export declare function printHelp({ commandName, headline, usage, tables, description, }: {
|
package/dist/core/messages.js
CHANGED
|
@@ -38,7 +38,7 @@ function serverStart({
|
|
|
38
38
|
host,
|
|
39
39
|
base
|
|
40
40
|
}) {
|
|
41
|
-
const version = "4.13.
|
|
41
|
+
const version = "4.13.1";
|
|
42
42
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
43
43
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
44
44
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -270,7 +270,7 @@ function printHelp({
|
|
|
270
270
|
message.push(
|
|
271
271
|
linebreak(),
|
|
272
272
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
273
|
-
`v${"4.13.
|
|
273
|
+
`v${"4.13.1"}`
|
|
274
274
|
)} ${headline}`
|
|
275
275
|
);
|
|
276
276
|
}
|
|
@@ -299,7 +299,6 @@ export {
|
|
|
299
299
|
formatConfigErrorMessage,
|
|
300
300
|
formatErrorMessage,
|
|
301
301
|
fsStrictWarning,
|
|
302
|
-
getNetworkLogging,
|
|
303
302
|
newVersionAvailable,
|
|
304
303
|
preferenceDefault,
|
|
305
304
|
preferenceDefaultIntro,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createGetActionResult } from "../../actions/utils.js";
|
|
1
|
+
import { createCallAction, createGetActionResult } from "../../actions/utils.js";
|
|
2
2
|
import {
|
|
3
3
|
computeCurrentLocale,
|
|
4
4
|
computePreferredLocale,
|
|
@@ -77,7 +77,8 @@ function createContext({
|
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
79
|
return Object.assign(context, {
|
|
80
|
-
getActionResult: createGetActionResult(context.locals)
|
|
80
|
+
getActionResult: createGetActionResult(context.locals),
|
|
81
|
+
callAction: createCallAction(context.locals)
|
|
81
82
|
});
|
|
82
83
|
}
|
|
83
84
|
function isLocalsSerializable(value) {
|
|
@@ -8,7 +8,6 @@ export declare function createModuleScriptElement(script: {
|
|
|
8
8
|
value: string;
|
|
9
9
|
}, base?: string, assetsPrefix?: AssetsPrefix): SSRElement;
|
|
10
10
|
export declare function createModuleScriptElementWithSrc(src: string, base?: string, assetsPrefix?: AssetsPrefix): SSRElement;
|
|
11
|
-
export declare function createModuleScriptElementWithSrcSet(srces: string[], site?: string, assetsPrefix?: AssetsPrefix): Set<SSRElement>;
|
|
12
11
|
export declare function createModuleScriptsSet(scripts: {
|
|
13
12
|
type: 'inline' | 'external';
|
|
14
13
|
value: string;
|
|
@@ -50,11 +50,6 @@ function createModuleScriptElementWithSrc(src, base, assetsPrefix) {
|
|
|
50
50
|
children: ""
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
function createModuleScriptElementWithSrcSet(srces, site, assetsPrefix) {
|
|
54
|
-
return new Set(
|
|
55
|
-
srces.map((src) => createModuleScriptElementWithSrc(src, site, assetsPrefix))
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
53
|
function createModuleScriptsSet(scripts, base, assetsPrefix) {
|
|
59
54
|
return new Set(
|
|
60
55
|
scripts.map((script) => createModuleScriptElement(script, base, assetsPrefix))
|
|
@@ -64,7 +59,6 @@ export {
|
|
|
64
59
|
createAssetLink,
|
|
65
60
|
createModuleScriptElement,
|
|
66
61
|
createModuleScriptElementWithSrc,
|
|
67
|
-
createModuleScriptElementWithSrcSet,
|
|
68
62
|
createModuleScriptsSet,
|
|
69
63
|
createStylesheetElement,
|
|
70
64
|
createStylesheetElementSet
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { APIContext, AstroGlobal, AstroGlobalPartial, ComponentInstance, MiddlewareHandler, Props, RouteData, SSRResult } from '../@types/astro.js';
|
|
2
|
-
import type { ActionAPIContext } from '../actions/runtime/
|
|
2
|
+
import type { ActionAPIContext } from '../actions/runtime/utils.js';
|
|
3
3
|
import { AstroCookies } from './cookies/index.js';
|
|
4
4
|
import { type Pipeline } from './render/index.js';
|
|
5
5
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createGetActionResult, hasActionsInternal } from "../actions/utils.js";
|
|
1
|
+
import { createCallAction, createGetActionResult, hasActionsInternal } from "../actions/utils.js";
|
|
2
2
|
import {
|
|
3
3
|
computeCurrentLocale,
|
|
4
4
|
computePreferredLocale,
|
|
@@ -169,7 +169,8 @@ class RenderContext {
|
|
|
169
169
|
const context = this.createActionAPIContext();
|
|
170
170
|
return Object.assign(context, {
|
|
171
171
|
props,
|
|
172
|
-
getActionResult: createGetActionResult(context.locals)
|
|
172
|
+
getActionResult: createGetActionResult(context.locals),
|
|
173
|
+
callAction: createCallAction(context.locals)
|
|
173
174
|
});
|
|
174
175
|
}
|
|
175
176
|
async #executeRewrite(reroutePayload) {
|
|
@@ -370,6 +371,7 @@ class RenderContext {
|
|
|
370
371
|
rewrite,
|
|
371
372
|
request: this.request,
|
|
372
373
|
getActionResult: createGetActionResult(locals),
|
|
374
|
+
callAction: createCallAction(locals),
|
|
373
375
|
response,
|
|
374
376
|
site: pipeline.site,
|
|
375
377
|
url
|
package/dist/core/util.d.ts
CHANGED
|
@@ -38,8 +38,6 @@ export declare function isEndpoint(file: URL, settings: AstroSettings): boolean;
|
|
|
38
38
|
export declare function isServerLikeOutput(config: AstroConfig): boolean;
|
|
39
39
|
export declare function isModeServerWithNoAdapter(settings: AstroSettings): boolean;
|
|
40
40
|
export declare function isContentCollectionsCacheEnabled(config: AstroConfig): boolean;
|
|
41
|
-
export declare function relativeToSrcDir(config: AstroConfig, idOrUrl: URL | string): string;
|
|
42
|
-
export declare function emoji(char: string, fallback: string): string;
|
|
43
41
|
export declare function resolveJsToTs(filePath: string): string;
|
|
44
42
|
/**
|
|
45
43
|
* Set a default NODE_ENV so Vite doesn't set an incorrect default when loading the Astro config
|
package/dist/core/util.js
CHANGED
|
@@ -113,18 +113,6 @@ function isContentCollectionsCacheEnabled(config) {
|
|
|
113
113
|
return config.experimental.contentCollectionCache && // contentCollectionsCache is an SSG only feature
|
|
114
114
|
!isServerLikeOutput(config);
|
|
115
115
|
}
|
|
116
|
-
function relativeToSrcDir(config, idOrUrl) {
|
|
117
|
-
let id;
|
|
118
|
-
if (typeof idOrUrl !== "string") {
|
|
119
|
-
id = unwrapId(viteID(idOrUrl));
|
|
120
|
-
} else {
|
|
121
|
-
id = idOrUrl;
|
|
122
|
-
}
|
|
123
|
-
return id.slice(slash(fileURLToPath(config.srcDir)).length);
|
|
124
|
-
}
|
|
125
|
-
function emoji(char, fallback) {
|
|
126
|
-
return process.platform !== "win32" ? char : fallback;
|
|
127
|
-
}
|
|
128
116
|
function resolveJsToTs(filePath) {
|
|
129
117
|
if (filePath.endsWith(".jsx") && !fs.existsSync(filePath)) {
|
|
130
118
|
const tryPath = filePath.slice(0, -4) + ".tsx";
|
|
@@ -143,7 +131,6 @@ export {
|
|
|
143
131
|
NULL_BYTE_PLACEHOLDER,
|
|
144
132
|
VALID_ID_PREFIX,
|
|
145
133
|
arraify,
|
|
146
|
-
emoji,
|
|
147
134
|
ensureProcessNodeEnv,
|
|
148
135
|
getOutputFilename,
|
|
149
136
|
isContentCollectionsCacheEnabled,
|
|
@@ -156,7 +143,6 @@ export {
|
|
|
156
143
|
isURL,
|
|
157
144
|
padMultilineString,
|
|
158
145
|
parseNpmName,
|
|
159
|
-
relativeToSrcDir,
|
|
160
146
|
resolveJsToTs,
|
|
161
147
|
resolvePages,
|
|
162
148
|
unwrapId,
|
|
@@ -33,5 +33,4 @@ export interface AstroPreferences {
|
|
|
33
33
|
export declare function isValidKey(key: string): key is PreferenceKey;
|
|
34
34
|
export declare function coerce(key: string, value: unknown): any;
|
|
35
35
|
export default function createPreferences(config: AstroConfig): AstroPreferences;
|
|
36
|
-
export declare function getGlobalPreferenceDir(): string;
|
|
37
36
|
export {};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { RouteData, SSRResult } from '../../../@types/astro.js';
|
|
2
|
-
import { type RenderInstruction } from './instruction.js';
|
|
3
|
-
import type { HTMLBytes } from '../escape.js';
|
|
4
2
|
import { type RenderInstance } from './common.js';
|
|
5
3
|
import { type ComponentSlots } from './slot.js';
|
|
6
4
|
declare const needsHeadRenderingSymbol: unique symbol;
|
|
7
|
-
export type ComponentIterable = AsyncIterable<string | HTMLBytes | RenderInstruction>;
|
|
8
5
|
export declare function renderComponent(result: SSRResult, displayName: string, Component: unknown, props: Record<string | number, any>, slots?: ComponentSlots): Promise<RenderInstance>;
|
|
9
6
|
export declare function renderComponentToString(result: SSRResult, displayName: string, Component: unknown, props: Record<string | number, any>, slots?: any, isPage?: boolean, route?: RouteData): Promise<string>;
|
|
10
7
|
export type NonAstroPageComponent = {
|
|
@@ -12,10 +12,6 @@ export type CreateControllerParams = {
|
|
|
12
12
|
reload: ReloadFn;
|
|
13
13
|
};
|
|
14
14
|
export declare function createController(params: CreateControllerParams): DevServerController;
|
|
15
|
-
export declare function createBaseController({ reload }: {
|
|
16
|
-
reload: ReloadFn;
|
|
17
|
-
}): DevServerController;
|
|
18
|
-
export declare function createLoaderController(loader: ModuleLoader): DevServerController;
|
|
19
15
|
export interface RunWithErrorHandlingParams {
|
|
20
16
|
controller: DevServerController;
|
|
21
17
|
pathname: string;
|