astro 7.1.3 → 7.1.5
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/assets/types.d.ts +11 -0
- package/dist/cli/dev/background.js +1 -0
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/container/index.js +18 -22
- package/dist/content/content-layer.js +3 -3
- package/dist/content/loaders/file.js +1 -1
- package/dist/content/loaders/glob.js +6 -1
- package/dist/core/app/types.d.ts +0 -2
- package/dist/core/base-pipeline.js +9 -3
- package/dist/core/build/internal.d.ts +8 -0
- package/dist/core/build/internal.js +1 -0
- package/dist/core/build/plugins/plugin-css.js +44 -0
- package/dist/core/build/plugins/plugin-manifest.js +1 -6
- package/dist/core/config/schemas/base.d.ts +2 -68
- package/dist/core/config/schemas/base.js +2 -65
- package/dist/core/config/schemas/defaults.d.ts +67 -0
- package/dist/core/config/schemas/defaults.js +65 -0
- package/dist/core/config/settings.js +1 -1
- package/dist/core/config/vite-load.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/cookies/cookies.js +1 -1
- package/dist/core/create-vite.js +2 -0
- package/dist/core/createMinimalViteDevServer.d.ts +1 -1
- package/dist/core/createMinimalViteDevServer.js +3 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/errors/default-handler.d.ts +1 -1
- package/dist/core/errors/default-handler.js +16 -0
- package/dist/core/errors/dev-handler.d.ts +1 -1
- package/dist/core/errors/dev-handler.js +10 -0
- package/dist/core/errors/handler.d.ts +14 -0
- package/dist/core/errors/handler.js +7 -0
- package/dist/core/logger/load.d.ts +4 -0
- package/dist/core/logger/load.js +25 -51
- package/dist/core/logger/utils.d.ts +21 -0
- package/dist/core/logger/utils.js +20 -0
- package/dist/core/logger/vite-plugin.d.ts +30 -0
- package/dist/core/logger/vite-plugin.js +79 -0
- package/dist/core/messages/runtime.js +1 -1
- package/dist/core/routing/handler.js +16 -2
- package/dist/core/session/drivers.d.ts +1 -1
- package/dist/core/session/handler.js +2 -1
- package/dist/core/session/runtime.d.ts +10 -7
- package/dist/core/session/runtime.js +10 -7
- package/dist/manifest/serialized.js +4 -6
- package/dist/types/public/config.d.ts +3 -3
- package/package.json +10 -10
- package/components/env.d.ts +0 -2
package/dist/assets/types.d.ts
CHANGED
|
@@ -168,6 +168,17 @@ type ImageSharedProps<T> = T & {
|
|
|
168
168
|
* ```
|
|
169
169
|
*/
|
|
170
170
|
position?: string;
|
|
171
|
+
/**
|
|
172
|
+
* The background color to use when converting images with transparency to a format that does not support it (e.g. PNG to JPEG).
|
|
173
|
+
*
|
|
174
|
+
* The value is a string that specifies a CSS color value, e.g. `#fff`, `white`, `rgb(255, 255, 255)`.
|
|
175
|
+
*
|
|
176
|
+
* **Example**:
|
|
177
|
+
* ```astro
|
|
178
|
+
* <Image src={...} format="jpeg" background="#fff" alt="..." />
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
background?: string;
|
|
171
182
|
} & ({
|
|
172
183
|
/**
|
|
173
184
|
* The layout type for responsive images.
|
|
@@ -66,6 +66,7 @@ async function background({
|
|
|
66
66
|
const astroBin = resolve(dirname(require2.resolve("astro/package.json")), "bin", "astro.mjs");
|
|
67
67
|
const child = spawn(process.execPath, [astroBin, ...args], {
|
|
68
68
|
detached: true,
|
|
69
|
+
windowsHide: true,
|
|
69
70
|
stdio: ["ignore", logFd, logFd],
|
|
70
71
|
cwd: rootPath,
|
|
71
72
|
env: { ...process.env, ASTRO_DEV_BACKGROUND: "1" }
|
package/dist/container/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { ASTRO_CONFIG_DEFAULTS } from "../core/config/schemas/index.js";
|
|
4
|
-
import { validateConfig } from "../core/config/validate.js";
|
|
1
|
+
import { getDefaultClientDirectives } from "../core/client-directive/default.js";
|
|
2
|
+
import { ASTRO_CONFIG_DEFAULTS } from "../core/config/schemas/defaults.js";
|
|
5
3
|
import { createKey } from "../core/encryption.js";
|
|
6
4
|
import { FetchState } from "../core/fetch/fetch-state.js";
|
|
7
5
|
import { AstroMiddleware } from "../core/middleware/astro-middleware.js";
|
|
@@ -14,15 +12,18 @@ import { validateSegment } from "../core/routing/segment.js";
|
|
|
14
12
|
import { SlotString } from "../runtime/server/render/slot.js";
|
|
15
13
|
import { ContainerPipeline } from "./pipeline.js";
|
|
16
14
|
import { createConsoleLogger } from "../core/logger/impls/console.js";
|
|
17
|
-
const { gfm: _, smartypants: __, ...containerMarkdownDefaults } = ASTRO_CONFIG_DEFAULTS.markdown;
|
|
18
|
-
const CONTAINER_CONFIG_DEFAULTS = { ...ASTRO_CONFIG_DEFAULTS, markdown: containerMarkdownDefaults };
|
|
19
15
|
function createManifest(manifest, renderers, middleware) {
|
|
20
16
|
function middlewareInstance() {
|
|
21
17
|
return {
|
|
22
18
|
onRequest: middleware ?? NOOP_MIDDLEWARE_FN
|
|
23
19
|
};
|
|
24
20
|
}
|
|
25
|
-
|
|
21
|
+
let root;
|
|
22
|
+
try {
|
|
23
|
+
root = new URL(import.meta.url);
|
|
24
|
+
} catch {
|
|
25
|
+
root = new URL("file:///container/");
|
|
26
|
+
}
|
|
26
27
|
return {
|
|
27
28
|
rootDir: root,
|
|
28
29
|
srcDir: manifest?.srcDir ?? new URL(ASTRO_CONFIG_DEFAULTS.srcDir, root),
|
|
@@ -64,8 +65,7 @@ function createManifest(manifest, renderers, middleware) {
|
|
|
64
65
|
debugInfoOutput: "",
|
|
65
66
|
placement: void 0
|
|
66
67
|
},
|
|
67
|
-
logLevel: "silent"
|
|
68
|
-
loggerConfig: manifest?.loggerConfig ?? void 0
|
|
68
|
+
logLevel: "silent"
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
class experimental_AstroContainer {
|
|
@@ -81,17 +81,17 @@ class experimental_AstroContainer {
|
|
|
81
81
|
streaming = false,
|
|
82
82
|
manifest,
|
|
83
83
|
renderers,
|
|
84
|
-
resolve
|
|
85
|
-
astroConfig
|
|
84
|
+
resolve
|
|
86
85
|
}) {
|
|
86
|
+
const ssrManifest = createManifest(manifest, renderers);
|
|
87
87
|
this.#pipeline = ContainerPipeline.create({
|
|
88
88
|
logger: createConsoleLogger({ level: "error" }),
|
|
89
|
-
manifest:
|
|
89
|
+
manifest: ssrManifest,
|
|
90
90
|
streaming,
|
|
91
91
|
renderers: renderers ?? manifest?.renderers ?? [],
|
|
92
92
|
resolve: async (specifier) => {
|
|
93
93
|
if (this.#withManifest) {
|
|
94
|
-
return this.#containerResolve(specifier,
|
|
94
|
+
return this.#containerResolve(specifier, ssrManifest);
|
|
95
95
|
} else if (resolve) {
|
|
96
96
|
return resolve(specifier);
|
|
97
97
|
}
|
|
@@ -101,10 +101,10 @@ class experimental_AstroContainer {
|
|
|
101
101
|
this.#astroMiddleware = new AstroMiddleware(this.#pipeline);
|
|
102
102
|
this.#pagesHandler = new PagesHandler(this.#pipeline);
|
|
103
103
|
}
|
|
104
|
-
async #containerResolve(specifier,
|
|
105
|
-
const found =
|
|
104
|
+
async #containerResolve(specifier, manifest) {
|
|
105
|
+
const found = manifest.entryModules[specifier];
|
|
106
106
|
if (found) {
|
|
107
|
-
return new URL(found,
|
|
107
|
+
return new URL(found, manifest.buildClientDir).toString();
|
|
108
108
|
}
|
|
109
109
|
return found;
|
|
110
110
|
}
|
|
@@ -115,12 +115,10 @@ class experimental_AstroContainer {
|
|
|
115
115
|
*/
|
|
116
116
|
static async create(containerOptions = {}) {
|
|
117
117
|
const { streaming = false, manifest, renderers = [], resolve } = containerOptions;
|
|
118
|
-
const astroConfig = await validateConfig(CONTAINER_CONFIG_DEFAULTS, process.cwd(), "container");
|
|
119
118
|
return new experimental_AstroContainer({
|
|
120
119
|
streaming,
|
|
121
120
|
manifest,
|
|
122
121
|
renderers,
|
|
123
|
-
astroConfig,
|
|
124
122
|
resolve
|
|
125
123
|
});
|
|
126
124
|
}
|
|
@@ -208,10 +206,8 @@ class experimental_AstroContainer {
|
|
|
208
206
|
// NOTE: we keep this private via TS instead via `#` so it's still available on the surface, so we can play with it.
|
|
209
207
|
// @ts-expect-error @ematipico: I plan to use it for a possible integration that could help people
|
|
210
208
|
static async createFromManifest(manifest) {
|
|
211
|
-
const astroConfig = await validateConfig(CONTAINER_CONFIG_DEFAULTS, process.cwd(), "container");
|
|
212
209
|
const container = new experimental_AstroContainer({
|
|
213
|
-
manifest
|
|
214
|
-
astroConfig
|
|
210
|
+
manifest
|
|
215
211
|
});
|
|
216
212
|
container.#withManifest = true;
|
|
217
213
|
return container;
|
|
@@ -330,7 +326,7 @@ class experimental_AstroContainer {
|
|
|
330
326
|
this.#pipeline.insertRoute(routeData, componentInstance);
|
|
331
327
|
}
|
|
332
328
|
#createRoute(url, params, type) {
|
|
333
|
-
const segments = removeLeadingForwardSlash(url.pathname).split(
|
|
329
|
+
const segments = removeLeadingForwardSlash(url.pathname).split("/").filter(Boolean).map((s) => {
|
|
334
330
|
validateSegment(s);
|
|
335
331
|
return getParts(s, url.pathname);
|
|
336
332
|
});
|
|
@@ -196,7 +196,7 @@ ${contentConfig.error.message}`
|
|
|
196
196
|
logger.info("Content config changed");
|
|
197
197
|
shouldClear = true;
|
|
198
198
|
}
|
|
199
|
-
if (previousAstroVersion && previousAstroVersion !== "7.1.
|
|
199
|
+
if (previousAstroVersion && previousAstroVersion !== "7.1.5") {
|
|
200
200
|
logger.info("Astro version changed");
|
|
201
201
|
shouldClear = true;
|
|
202
202
|
}
|
|
@@ -204,8 +204,8 @@ ${contentConfig.error.message}`
|
|
|
204
204
|
logger.info("Clearing content store");
|
|
205
205
|
this.#store.clearAll();
|
|
206
206
|
}
|
|
207
|
-
if ("7.1.
|
|
208
|
-
this.#store.metaStore().set("astro-version", "7.1.
|
|
207
|
+
if ("7.1.5") {
|
|
208
|
+
this.#store.metaStore().set("astro-version", "7.1.5");
|
|
209
209
|
}
|
|
210
210
|
if (currentConfigDigest) {
|
|
211
211
|
this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, promises as fs } from "node:fs";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import yaml from "js-yaml";
|
|
4
|
-
import toml from "smol-toml";
|
|
4
|
+
import * as toml from "smol-toml";
|
|
5
5
|
import { FileGlobNotSupported, FileParserNotFound } from "../../core/errors/errors-data.js";
|
|
6
6
|
import { AstroError } from "../../core/errors/index.js";
|
|
7
7
|
import { posixRelative } from "../utils.js";
|
|
@@ -232,7 +232,12 @@ function glob(globOptions) {
|
|
|
232
232
|
return;
|
|
233
233
|
}
|
|
234
234
|
watcher.add(filePath);
|
|
235
|
-
const
|
|
235
|
+
const patterns = Array.isArray(globOptions.pattern) ? globOptions.pattern : [globOptions.pattern];
|
|
236
|
+
const positivePatterns = patterns.filter((p) => !p.startsWith("!"));
|
|
237
|
+
const negationPatterns = patterns.filter((p) => p.startsWith("!")).map((p) => p.slice(1));
|
|
238
|
+
const matchesGlob = (entry) => !entry.startsWith("../") && picomatch.isMatch(entry, positivePatterns, {
|
|
239
|
+
ignore: negationPatterns.length > 0 ? negationPatterns : void 0
|
|
240
|
+
});
|
|
236
241
|
const basePath = fileURLToPath(baseDir);
|
|
237
242
|
async function onChange(changedPath) {
|
|
238
243
|
const entry = posixRelative(basePath, changedPath);
|
package/dist/core/app/types.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ import type { BaseSessionConfig, SessionDriverFactory } from '../session/types.j
|
|
|
12
12
|
import type { DevToolbarPlacement } from '../../types/public/toolbar.js';
|
|
13
13
|
import type { MiddlewareMode } from '../../types/public/integrations.js';
|
|
14
14
|
import type { BaseApp } from './base.js';
|
|
15
|
-
import type { LoggerHandlerConfig } from '../logger/config.js';
|
|
16
15
|
type ComponentPath = string;
|
|
17
16
|
export type StylesheetAsset = {
|
|
18
17
|
type: 'inline';
|
|
@@ -138,7 +137,6 @@ export type SSRManifest = {
|
|
|
138
137
|
};
|
|
139
138
|
internalFetchHeaders?: Record<string, string>;
|
|
140
139
|
logLevel: AstroLoggerLevel;
|
|
141
|
-
loggerConfig: LoggerHandlerConfig | undefined;
|
|
142
140
|
};
|
|
143
141
|
export type SSRActions = {
|
|
144
142
|
server: Record<string, ActionClient<any, any, any>>;
|
|
@@ -11,7 +11,6 @@ import { createDefaultRoutes } from "./routing/default.js";
|
|
|
11
11
|
import { ensure404Route } from "./routing/astro-designed-error-pages.js";
|
|
12
12
|
import { Router } from "./routing/router.js";
|
|
13
13
|
import { FORBIDDEN_PATH_KEYS } from "@astrojs/internal-helpers/object";
|
|
14
|
-
import { loadLoggerDestination } from "./logger/load.js";
|
|
15
14
|
const PipelineFeatures = {
|
|
16
15
|
redirects: 1 << 0,
|
|
17
16
|
sessions: 1 << 1,
|
|
@@ -171,9 +170,10 @@ class Pipeline {
|
|
|
171
170
|
return this.logger;
|
|
172
171
|
}
|
|
173
172
|
this.resolvedLogger = true;
|
|
174
|
-
|
|
173
|
+
const destination = (await this.manifest.logger?.())?.default;
|
|
174
|
+
if (destination) {
|
|
175
175
|
this.logger = new AstroLogger({
|
|
176
|
-
destination
|
|
176
|
+
destination,
|
|
177
177
|
level: this.manifest.logLevel
|
|
178
178
|
});
|
|
179
179
|
}
|
|
@@ -231,6 +231,12 @@ class Pipeline {
|
|
|
231
231
|
);
|
|
232
232
|
}
|
|
233
233
|
for (const key of pathKeys) {
|
|
234
|
+
if (typeof server === "function") {
|
|
235
|
+
throw new AstroError({
|
|
236
|
+
...ActionNotFoundError,
|
|
237
|
+
message: ActionNotFoundError.message(pathKeys.join("."))
|
|
238
|
+
});
|
|
239
|
+
}
|
|
234
240
|
if (FORBIDDEN_PATH_KEYS.has(key)) {
|
|
235
241
|
throw new AstroError({
|
|
236
242
|
...ActionNotFoundError,
|
|
@@ -10,6 +10,14 @@ export interface BuildInternals {
|
|
|
10
10
|
* build so the client can pick up the same information and use the same chunk ids.
|
|
11
11
|
*/
|
|
12
12
|
cssModuleToChunkIdMap: Map<string, string>;
|
|
13
|
+
/**
|
|
14
|
+
* Maps a key describing the exact set of CSS modules bundled into a chunk of the
|
|
15
|
+
* prerender environment to the CSS asset filename emitted for that chunk. The SSR
|
|
16
|
+
* environment renames its own CSS assets to these filenames when they are backed by
|
|
17
|
+
* the same CSS source modules, so the prerender and server builds don't emit
|
|
18
|
+
* duplicate stylesheets for shared layouts (#17298).
|
|
19
|
+
*/
|
|
20
|
+
prerenderCssAssetByModuleKey: Map<string, string>;
|
|
13
21
|
/**
|
|
14
22
|
* If script is inlined, its id and inlined code is mapped here. The resolved id is
|
|
15
23
|
* an URL like "/_astro/something.js" but will no longer exist as the content is now
|
|
@@ -4,6 +4,7 @@ function createBuildInternals() {
|
|
|
4
4
|
return {
|
|
5
5
|
clientInput: /* @__PURE__ */ new Set(),
|
|
6
6
|
cssModuleToChunkIdMap: /* @__PURE__ */ new Map(),
|
|
7
|
+
prerenderCssAssetByModuleKey: /* @__PURE__ */ new Map(),
|
|
7
8
|
inlinedScripts: /* @__PURE__ */ new Map(),
|
|
8
9
|
entrySpecifierToBundleMap: /* @__PURE__ */ new Map(),
|
|
9
10
|
pagesByKeys: /* @__PURE__ */ new Map(),
|
|
@@ -46,6 +46,20 @@ function rollupPluginAstroBuildCSS(options) {
|
|
|
46
46
|
internals.cssModuleToChunkIdMap.set(moduleId, chunk.fileName);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
+
const cssModuleIds = Object.keys(chunk.modules || {}).filter(isCSSRequest);
|
|
50
|
+
const importedCss = chunk.viteMetadata?.importedCss;
|
|
51
|
+
if (cssModuleIds.length > 0 && importedCss?.size === 1) {
|
|
52
|
+
const moduleKey = cssModuleIds.sort().join("\n");
|
|
53
|
+
const [assetFileName] = importedCss;
|
|
54
|
+
if (this.environment?.name === ASTRO_VITE_ENVIRONMENT_NAMES.prerender) {
|
|
55
|
+
internals.prerenderCssAssetByModuleKey.set(moduleKey, assetFileName);
|
|
56
|
+
} else {
|
|
57
|
+
const prerenderFileName = internals.prerenderCssAssetByModuleKey.get(moduleKey);
|
|
58
|
+
if (prerenderFileName && prerenderFileName !== assetFileName) {
|
|
59
|
+
renameBundleAsset(bundle, assetFileName, prerenderFileName);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
49
63
|
for (const [moduleId, moduleInfo] of Object.entries(chunk.modules || {})) {
|
|
50
64
|
if (moduleInfo.renderedExports.length > 0) {
|
|
51
65
|
const existing = internals.ssrRenderedExports?.get(moduleId);
|
|
@@ -112,6 +126,21 @@ function rollupPluginAstroBuildCSS(options) {
|
|
|
112
126
|
for (const importedCssImport of meta.importedCss) {
|
|
113
127
|
const cssToInfoRecord = pagesToCss[pageData.moduleSpecifier] ??= {};
|
|
114
128
|
cssToInfoRecord[importedCssImport] = { depth: -1, order: -1 };
|
|
129
|
+
if (deletedCssAssets.has(importedCssImport)) {
|
|
130
|
+
const cssAsset = deletedCssAssets.get(importedCssImport);
|
|
131
|
+
if (cssAsset.type === "asset" && typeof cssAsset.source === "string" && cssAsset.source.length > 0) {
|
|
132
|
+
const sheet = {
|
|
133
|
+
type: "inline",
|
|
134
|
+
content: cssAsset.source
|
|
135
|
+
};
|
|
136
|
+
const alreadyAdded = pageData.styles.some(
|
|
137
|
+
(s) => s.sheet.type === "inline" && s.sheet.content === sheet.content
|
|
138
|
+
);
|
|
139
|
+
if (!alreadyAdded) {
|
|
140
|
+
pageData.styles.push({ depth: -1, order: -1, sheet });
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
115
144
|
}
|
|
116
145
|
}
|
|
117
146
|
}
|
|
@@ -316,6 +345,21 @@ function rollupPluginAstroBuildCSS(options) {
|
|
|
316
345
|
};
|
|
317
346
|
return [cssBuildPlugin, singleCssPlugin, inlineStylesheetsPlugin];
|
|
318
347
|
}
|
|
348
|
+
function renameBundleAsset(bundle, fromFileName, toFileName) {
|
|
349
|
+
const asset = bundle[fromFileName];
|
|
350
|
+
if (!asset || asset.type !== "asset" || bundle[toFileName]) return;
|
|
351
|
+
asset.fileName = toFileName;
|
|
352
|
+
for (const chunk of Object.values(bundle)) {
|
|
353
|
+
if (chunk.type !== "chunk") continue;
|
|
354
|
+
const meta = chunk.viteMetadata;
|
|
355
|
+
if (meta?.importedCss?.delete(fromFileName)) {
|
|
356
|
+
meta.importedCss.add(toFileName);
|
|
357
|
+
}
|
|
358
|
+
if (meta?.importedAssets?.delete(fromFileName)) {
|
|
359
|
+
meta.importedAssets.add(toFileName);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
319
363
|
function shouldDeleteCSSChunk(allModules, internals) {
|
|
320
364
|
const componentPaths = /* @__PURE__ */ new Set();
|
|
321
365
|
for (const componentPath of internals.discoveredClientOnlyComponents.keys()) {
|
|
@@ -236,10 +236,6 @@ async function buildManifest(opts, internals, staticFiles, encodedKey) {
|
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
const middlewareMode = resolveMiddlewareMode(opts.settings.adapter?.adapterFeatures);
|
|
239
|
-
let loggerConfig = void 0;
|
|
240
|
-
if (settings.config.logger) {
|
|
241
|
-
loggerConfig = settings.config.logger;
|
|
242
|
-
}
|
|
243
239
|
return {
|
|
244
240
|
rootDir: opts.settings.config.root.toString(),
|
|
245
241
|
cacheDir: opts.settings.config.cacheDir.toString(),
|
|
@@ -288,8 +284,7 @@ async function buildManifest(opts, internals, staticFiles, encodedKey) {
|
|
|
288
284
|
},
|
|
289
285
|
internalFetchHeaders,
|
|
290
286
|
logLevel: settings.logLevel,
|
|
291
|
-
shouldInjectCspMetaTags: shouldTrackCspHashes(settings.config.security.csp)
|
|
292
|
-
loggerConfig
|
|
287
|
+
shouldInjectCspMetaTags: shouldTrackCspHashes(settings.config.security.csp)
|
|
293
288
|
};
|
|
294
289
|
}
|
|
295
290
|
export {
|
|
@@ -16,73 +16,8 @@ type RemarkPlugin = ComplexifyWithUnion<_RemarkPlugin>;
|
|
|
16
16
|
export type RemarkRehype = ComplexifyWithOmit<_RemarkRehype>;
|
|
17
17
|
/** @lintignore */
|
|
18
18
|
export type Smartypants = ComplexifyWithOmit<_Smartypants>;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
srcDir: string;
|
|
22
|
-
publicDir: string;
|
|
23
|
-
outDir: string;
|
|
24
|
-
cacheDir: string;
|
|
25
|
-
base: string;
|
|
26
|
-
trailingSlash: "ignore";
|
|
27
|
-
build: {
|
|
28
|
-
format: "directory";
|
|
29
|
-
client: string;
|
|
30
|
-
server: string;
|
|
31
|
-
assets: string;
|
|
32
|
-
serverEntry: string;
|
|
33
|
-
redirects: true;
|
|
34
|
-
inlineStylesheets: "auto";
|
|
35
|
-
concurrency: number;
|
|
36
|
-
};
|
|
37
|
-
image: {
|
|
38
|
-
endpoint: {
|
|
39
|
-
entrypoint: undefined;
|
|
40
|
-
route: "/_image";
|
|
41
|
-
};
|
|
42
|
-
service: {
|
|
43
|
-
entrypoint: "astro/assets/services/sharp";
|
|
44
|
-
config: {};
|
|
45
|
-
};
|
|
46
|
-
dangerouslyProcessSVG: false;
|
|
47
|
-
responsiveStyles: false;
|
|
48
|
-
};
|
|
49
|
-
devToolbar: {
|
|
50
|
-
enabled: true;
|
|
51
|
-
};
|
|
52
|
-
compressHTML: "jsx";
|
|
53
|
-
server: {
|
|
54
|
-
host: false;
|
|
55
|
-
port: number;
|
|
56
|
-
open: false;
|
|
57
|
-
allowedHosts: never[];
|
|
58
|
-
};
|
|
59
|
-
integrations: never[];
|
|
60
|
-
markdown: Required<Omit<import("@astrojs/internal-helpers/markdown").AstroMarkdownOptions, "image">>;
|
|
61
|
-
vite: {};
|
|
62
|
-
legacy: {
|
|
63
|
-
collectionsBackwardsCompat: false;
|
|
64
|
-
};
|
|
65
|
-
redirects: {};
|
|
66
|
-
security: {
|
|
67
|
-
checkOrigin: true;
|
|
68
|
-
allowedDomains: never[];
|
|
69
|
-
csp: false;
|
|
70
|
-
actionBodySizeLimit: number;
|
|
71
|
-
serverIslandBodySizeLimit: number;
|
|
72
|
-
};
|
|
73
|
-
env: {
|
|
74
|
-
schema: {};
|
|
75
|
-
validateSecrets: false;
|
|
76
|
-
};
|
|
77
|
-
prerenderConflictBehavior: "warn";
|
|
78
|
-
fetchFile: string;
|
|
79
|
-
experimental: {
|
|
80
|
-
clientPrerender: false;
|
|
81
|
-
contentIntellisense: false;
|
|
82
|
-
chromeDevtoolsWorkspace: false;
|
|
83
|
-
collectionStorage: "single-file";
|
|
84
|
-
};
|
|
85
|
-
};
|
|
19
|
+
import { ASTRO_CONFIG_DEFAULTS } from './defaults.js';
|
|
20
|
+
export { ASTRO_CONFIG_DEFAULTS };
|
|
86
21
|
export declare const AstroConfigSchema: z.ZodObject<{
|
|
87
22
|
root: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodTransform<URL, string>>;
|
|
88
23
|
srcDir: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodString>>, z.ZodTransform<URL, string>>;
|
|
@@ -563,4 +498,3 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
563
498
|
}, z.core.$strip>>;
|
|
564
499
|
}, z.core.$strip>;
|
|
565
500
|
export type AstroConfigType = z.infer<typeof AstroConfigSchema>;
|
|
566
|
-
export {};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
markdownConfigDefaults,
|
|
3
|
-
syntaxHighlightDefaults
|
|
4
|
-
} from "@astrojs/internal-helpers/markdown";
|
|
1
|
+
import { syntaxHighlightDefaults } from "@astrojs/internal-helpers/markdown";
|
|
5
2
|
import { satteri } from "@astrojs/markdown-satteri";
|
|
6
3
|
import { bundledThemes } from "shiki";
|
|
7
4
|
import * as z from "zod/v4";
|
|
@@ -16,67 +13,7 @@ import {
|
|
|
16
13
|
cspResourceEntrySchema
|
|
17
14
|
} from "../../csp/config.js";
|
|
18
15
|
import { SessionSchema } from "../../session/config.js";
|
|
19
|
-
|
|
20
|
-
root: ".",
|
|
21
|
-
srcDir: "./src",
|
|
22
|
-
publicDir: "./public",
|
|
23
|
-
outDir: "./dist",
|
|
24
|
-
cacheDir: "./node_modules/.astro",
|
|
25
|
-
base: "/",
|
|
26
|
-
trailingSlash: "ignore",
|
|
27
|
-
build: {
|
|
28
|
-
format: "directory",
|
|
29
|
-
client: "./client/",
|
|
30
|
-
server: "./server/",
|
|
31
|
-
assets: "_astro",
|
|
32
|
-
serverEntry: "entry.mjs",
|
|
33
|
-
redirects: true,
|
|
34
|
-
inlineStylesheets: "auto",
|
|
35
|
-
concurrency: 1
|
|
36
|
-
},
|
|
37
|
-
image: {
|
|
38
|
-
endpoint: { entrypoint: void 0, route: "/_image" },
|
|
39
|
-
service: { entrypoint: "astro/assets/services/sharp", config: {} },
|
|
40
|
-
dangerouslyProcessSVG: false,
|
|
41
|
-
responsiveStyles: false
|
|
42
|
-
},
|
|
43
|
-
devToolbar: {
|
|
44
|
-
enabled: true
|
|
45
|
-
},
|
|
46
|
-
compressHTML: "jsx",
|
|
47
|
-
server: {
|
|
48
|
-
host: false,
|
|
49
|
-
port: 4321,
|
|
50
|
-
open: false,
|
|
51
|
-
allowedHosts: []
|
|
52
|
-
},
|
|
53
|
-
integrations: [],
|
|
54
|
-
markdown: markdownConfigDefaults,
|
|
55
|
-
vite: {},
|
|
56
|
-
legacy: {
|
|
57
|
-
collectionsBackwardsCompat: false
|
|
58
|
-
},
|
|
59
|
-
redirects: {},
|
|
60
|
-
security: {
|
|
61
|
-
checkOrigin: true,
|
|
62
|
-
allowedDomains: [],
|
|
63
|
-
csp: false,
|
|
64
|
-
actionBodySizeLimit: 1024 * 1024,
|
|
65
|
-
serverIslandBodySizeLimit: 1024 * 1024
|
|
66
|
-
},
|
|
67
|
-
env: {
|
|
68
|
-
schema: {},
|
|
69
|
-
validateSecrets: false
|
|
70
|
-
},
|
|
71
|
-
prerenderConflictBehavior: "warn",
|
|
72
|
-
fetchFile: "fetch",
|
|
73
|
-
experimental: {
|
|
74
|
-
clientPrerender: false,
|
|
75
|
-
contentIntellisense: false,
|
|
76
|
-
chromeDevtoolsWorkspace: false,
|
|
77
|
-
collectionStorage: "single-file"
|
|
78
|
-
}
|
|
79
|
-
};
|
|
16
|
+
import { ASTRO_CONFIG_DEFAULTS } from "./defaults.js";
|
|
80
17
|
const highlighterTypesSchema = z.union([z.literal("shiki"), z.literal("prism")]).default(syntaxHighlightDefaults.type);
|
|
81
18
|
const quoteCharacterMapSchema = z.object({
|
|
82
19
|
double: z.string(),
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export declare const ASTRO_CONFIG_DEFAULTS: {
|
|
2
|
+
root: string;
|
|
3
|
+
srcDir: string;
|
|
4
|
+
publicDir: string;
|
|
5
|
+
outDir: string;
|
|
6
|
+
cacheDir: string;
|
|
7
|
+
base: string;
|
|
8
|
+
trailingSlash: "ignore";
|
|
9
|
+
build: {
|
|
10
|
+
format: "directory";
|
|
11
|
+
client: string;
|
|
12
|
+
server: string;
|
|
13
|
+
assets: string;
|
|
14
|
+
serverEntry: string;
|
|
15
|
+
redirects: true;
|
|
16
|
+
inlineStylesheets: "auto";
|
|
17
|
+
concurrency: number;
|
|
18
|
+
};
|
|
19
|
+
image: {
|
|
20
|
+
endpoint: {
|
|
21
|
+
entrypoint: undefined;
|
|
22
|
+
route: "/_image";
|
|
23
|
+
};
|
|
24
|
+
service: {
|
|
25
|
+
entrypoint: "astro/assets/services/sharp";
|
|
26
|
+
config: {};
|
|
27
|
+
};
|
|
28
|
+
dangerouslyProcessSVG: false;
|
|
29
|
+
responsiveStyles: false;
|
|
30
|
+
};
|
|
31
|
+
devToolbar: {
|
|
32
|
+
enabled: true;
|
|
33
|
+
};
|
|
34
|
+
compressHTML: "jsx";
|
|
35
|
+
server: {
|
|
36
|
+
host: false;
|
|
37
|
+
port: number;
|
|
38
|
+
open: false;
|
|
39
|
+
allowedHosts: never[];
|
|
40
|
+
};
|
|
41
|
+
integrations: never[];
|
|
42
|
+
markdown: Required<Omit<import("@astrojs/internal-helpers/markdown").AstroMarkdownOptions, "image">>;
|
|
43
|
+
vite: {};
|
|
44
|
+
legacy: {
|
|
45
|
+
collectionsBackwardsCompat: false;
|
|
46
|
+
};
|
|
47
|
+
redirects: {};
|
|
48
|
+
security: {
|
|
49
|
+
checkOrigin: true;
|
|
50
|
+
allowedDomains: never[];
|
|
51
|
+
csp: false;
|
|
52
|
+
actionBodySizeLimit: number;
|
|
53
|
+
serverIslandBodySizeLimit: number;
|
|
54
|
+
};
|
|
55
|
+
env: {
|
|
56
|
+
schema: {};
|
|
57
|
+
validateSecrets: false;
|
|
58
|
+
};
|
|
59
|
+
prerenderConflictBehavior: "warn";
|
|
60
|
+
fetchFile: string;
|
|
61
|
+
experimental: {
|
|
62
|
+
clientPrerender: false;
|
|
63
|
+
contentIntellisense: false;
|
|
64
|
+
chromeDevtoolsWorkspace: false;
|
|
65
|
+
collectionStorage: "single-file";
|
|
66
|
+
};
|
|
67
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { markdownConfigDefaults } from "@astrojs/internal-helpers/markdown";
|
|
2
|
+
const ASTRO_CONFIG_DEFAULTS = {
|
|
3
|
+
root: ".",
|
|
4
|
+
srcDir: "./src",
|
|
5
|
+
publicDir: "./public",
|
|
6
|
+
outDir: "./dist",
|
|
7
|
+
cacheDir: "./node_modules/.astro",
|
|
8
|
+
base: "/",
|
|
9
|
+
trailingSlash: "ignore",
|
|
10
|
+
build: {
|
|
11
|
+
format: "directory",
|
|
12
|
+
client: "./client/",
|
|
13
|
+
server: "./server/",
|
|
14
|
+
assets: "_astro",
|
|
15
|
+
serverEntry: "entry.mjs",
|
|
16
|
+
redirects: true,
|
|
17
|
+
inlineStylesheets: "auto",
|
|
18
|
+
concurrency: 1
|
|
19
|
+
},
|
|
20
|
+
image: {
|
|
21
|
+
endpoint: { entrypoint: void 0, route: "/_image" },
|
|
22
|
+
service: { entrypoint: "astro/assets/services/sharp", config: {} },
|
|
23
|
+
dangerouslyProcessSVG: false,
|
|
24
|
+
responsiveStyles: false
|
|
25
|
+
},
|
|
26
|
+
devToolbar: {
|
|
27
|
+
enabled: true
|
|
28
|
+
},
|
|
29
|
+
compressHTML: "jsx",
|
|
30
|
+
server: {
|
|
31
|
+
host: false,
|
|
32
|
+
port: 4321,
|
|
33
|
+
open: false,
|
|
34
|
+
allowedHosts: []
|
|
35
|
+
},
|
|
36
|
+
integrations: [],
|
|
37
|
+
markdown: markdownConfigDefaults,
|
|
38
|
+
vite: {},
|
|
39
|
+
legacy: {
|
|
40
|
+
collectionsBackwardsCompat: false
|
|
41
|
+
},
|
|
42
|
+
redirects: {},
|
|
43
|
+
security: {
|
|
44
|
+
checkOrigin: true,
|
|
45
|
+
allowedDomains: [],
|
|
46
|
+
csp: false,
|
|
47
|
+
actionBodySizeLimit: 1024 * 1024,
|
|
48
|
+
serverIslandBodySizeLimit: 1024 * 1024
|
|
49
|
+
},
|
|
50
|
+
env: {
|
|
51
|
+
schema: {},
|
|
52
|
+
validateSecrets: false
|
|
53
|
+
},
|
|
54
|
+
prerenderConflictBehavior: "warn",
|
|
55
|
+
fetchFile: "fetch",
|
|
56
|
+
experimental: {
|
|
57
|
+
clientPrerender: false,
|
|
58
|
+
contentIntellisense: false,
|
|
59
|
+
chromeDevtoolsWorkspace: false,
|
|
60
|
+
collectionStorage: "single-file"
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
ASTRO_CONFIG_DEFAULTS
|
|
65
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
3
3
|
import yaml from "js-yaml";
|
|
4
|
-
import toml from "smol-toml";
|
|
4
|
+
import * as toml from "smol-toml";
|
|
5
5
|
import { getContentPaths } from "../../content/index.js";
|
|
6
6
|
import createPreferences from "../../preferences/index.js";
|
|
7
7
|
import { markdownContentEntryType } from "../../vite-plugin-markdown/content-entry-type.js";
|
|
@@ -23,7 +23,7 @@ async function loadConfigWithVite({
|
|
|
23
23
|
let server;
|
|
24
24
|
try {
|
|
25
25
|
const plugins = loadFallbackPlugin({ fs, root: pathToFileURL(root) });
|
|
26
|
-
server = await createMinimalViteDevServer(plugins);
|
|
26
|
+
server = await createMinimalViteDevServer(plugins, root);
|
|
27
27
|
if (isRunnableDevEnvironment(server.environments[ASTRO_VITE_ENVIRONMENT_NAMES.ssr])) {
|
|
28
28
|
const environment = server.environments[ASTRO_VITE_ENVIRONMENT_NAMES.ssr];
|
|
29
29
|
const mod = await environment.runner.import(configPath);
|
package/dist/core/constants.js
CHANGED