astro 5.11.2 → 5.12.0
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/content/content-layer.js +3 -3
- package/dist/content/loaders/file.js +3 -0
- package/dist/core/config/schemas/base.d.ts +6 -0
- package/dist/core/config/schemas/base.js +4 -2
- package/dist/core/config/schemas/relative.d.ts +7 -0
- package/dist/core/config/settings.js +32 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/create-vite.js +8 -3
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/errors/errors-data.d.ts +2 -2
- package/dist/core/errors/errors-data.js +1 -1
- package/dist/core/errors/utils.d.ts +4 -0
- package/dist/core/errors/utils.js +14 -0
- package/dist/core/messages.js +2 -2
- package/dist/env/env-loader.d.ts +1 -1
- package/dist/env/env-loader.js +4 -4
- package/dist/types/public/config.d.ts +18 -0
- package/package.json +4 -3
|
@@ -164,7 +164,7 @@ ${contentConfig.error.message}`);
|
|
|
164
164
|
logger.info("Content config changed");
|
|
165
165
|
shouldClear = true;
|
|
166
166
|
}
|
|
167
|
-
if (previousAstroVersion && previousAstroVersion !== "5.
|
|
167
|
+
if (previousAstroVersion && previousAstroVersion !== "5.12.0") {
|
|
168
168
|
logger.info("Astro version changed");
|
|
169
169
|
shouldClear = true;
|
|
170
170
|
}
|
|
@@ -172,8 +172,8 @@ ${contentConfig.error.message}`);
|
|
|
172
172
|
logger.info("Clearing content store");
|
|
173
173
|
this.#store.clearAll();
|
|
174
174
|
}
|
|
175
|
-
if ("5.
|
|
176
|
-
await this.#store.metaStore().set("astro-version", "5.
|
|
175
|
+
if ("5.12.0") {
|
|
176
|
+
await this.#store.metaStore().set("astro-version", "5.12.0");
|
|
177
177
|
}
|
|
178
178
|
if (currentConfigDigest) {
|
|
179
179
|
await this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
|
@@ -1,6 +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
5
|
import { FileGlobNotSupported, FileParserNotFound } from "../../core/errors/errors-data.js";
|
|
5
6
|
import { AstroError } from "../../core/errors/index.js";
|
|
6
7
|
import { posixRelative } from "../utils.js";
|
|
@@ -16,6 +17,8 @@ function file(fileName, options) {
|
|
|
16
17
|
parse = (text) => yaml.load(text, {
|
|
17
18
|
filename: fileName
|
|
18
19
|
});
|
|
20
|
+
} else if (ext === "toml") {
|
|
21
|
+
parse = toml.parse;
|
|
19
22
|
}
|
|
20
23
|
if (options?.parser) parse = options.parser;
|
|
21
24
|
if (parse === null) {
|
|
@@ -75,6 +75,7 @@ export declare const ASTRO_CONFIG_DEFAULTS: {
|
|
|
75
75
|
preserveScriptOrder: false;
|
|
76
76
|
liveContentCollections: false;
|
|
77
77
|
csp: false;
|
|
78
|
+
rawEnvValues: false;
|
|
78
79
|
};
|
|
79
80
|
};
|
|
80
81
|
export declare const AstroConfigSchema: z.ZodObject<{
|
|
@@ -975,6 +976,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
975
976
|
strictDynamic?: boolean | undefined;
|
|
976
977
|
} | undefined;
|
|
977
978
|
}>]>>>;
|
|
979
|
+
rawEnvValues: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
978
980
|
}, "strict", z.ZodTypeAny, {
|
|
979
981
|
clientPrerender: boolean;
|
|
980
982
|
contentIntellisense: boolean;
|
|
@@ -994,6 +996,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
994
996
|
strictDynamic?: boolean | undefined;
|
|
995
997
|
} | undefined;
|
|
996
998
|
};
|
|
999
|
+
rawEnvValues: boolean;
|
|
997
1000
|
fonts?: ({
|
|
998
1001
|
name: string;
|
|
999
1002
|
cssVariable: string;
|
|
@@ -1123,6 +1126,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
1123
1126
|
strictDynamic?: boolean | undefined;
|
|
1124
1127
|
} | undefined;
|
|
1125
1128
|
} | undefined;
|
|
1129
|
+
rawEnvValues?: boolean | undefined;
|
|
1126
1130
|
}>>;
|
|
1127
1131
|
legacy: z.ZodDefault<z.ZodObject<{
|
|
1128
1132
|
collections: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -1282,6 +1286,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
1282
1286
|
strictDynamic?: boolean | undefined;
|
|
1283
1287
|
} | undefined;
|
|
1284
1288
|
};
|
|
1289
|
+
rawEnvValues: boolean;
|
|
1285
1290
|
fonts?: ({
|
|
1286
1291
|
name: string;
|
|
1287
1292
|
cssVariable: string;
|
|
@@ -1610,6 +1615,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
|
|
|
1610
1615
|
strictDynamic?: boolean | undefined;
|
|
1611
1616
|
} | undefined;
|
|
1612
1617
|
} | undefined;
|
|
1618
|
+
rawEnvValues?: boolean | undefined;
|
|
1613
1619
|
} | undefined;
|
|
1614
1620
|
legacy?: {
|
|
1615
1621
|
collections?: boolean | undefined;
|
|
@@ -58,7 +58,8 @@ const ASTRO_CONFIG_DEFAULTS = {
|
|
|
58
58
|
headingIdCompat: false,
|
|
59
59
|
preserveScriptOrder: false,
|
|
60
60
|
liveContentCollections: false,
|
|
61
|
-
csp: false
|
|
61
|
+
csp: false,
|
|
62
|
+
rawEnvValues: false
|
|
62
63
|
}
|
|
63
64
|
};
|
|
64
65
|
const highlighterTypesSchema = z.union([z.literal("shiki"), z.literal("prism")]).default(syntaxHighlightDefaults.type);
|
|
@@ -283,7 +284,8 @@ const AstroConfigSchema = z.object({
|
|
|
283
284
|
strictDynamic: z.boolean().optional()
|
|
284
285
|
}).optional()
|
|
285
286
|
})
|
|
286
|
-
]).optional().default(ASTRO_CONFIG_DEFAULTS.experimental.csp)
|
|
287
|
+
]).optional().default(ASTRO_CONFIG_DEFAULTS.experimental.csp),
|
|
288
|
+
rawEnvValues: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.experimental.rawEnvValues)
|
|
287
289
|
}).strict(
|
|
288
290
|
`Invalid or outdated experimental feature.
|
|
289
291
|
Check for incorrect spelling or outdated Astro version.
|
|
@@ -898,6 +898,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
898
898
|
strictDynamic?: boolean | undefined;
|
|
899
899
|
} | undefined;
|
|
900
900
|
}>]>>>;
|
|
901
|
+
rawEnvValues: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
901
902
|
}, "strict", z.ZodTypeAny, {
|
|
902
903
|
clientPrerender: boolean;
|
|
903
904
|
contentIntellisense: boolean;
|
|
@@ -917,6 +918,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
917
918
|
strictDynamic?: boolean | undefined;
|
|
918
919
|
} | undefined;
|
|
919
920
|
};
|
|
921
|
+
rawEnvValues: boolean;
|
|
920
922
|
fonts?: ({
|
|
921
923
|
name: string;
|
|
922
924
|
cssVariable: string;
|
|
@@ -1046,6 +1048,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1046
1048
|
strictDynamic?: boolean | undefined;
|
|
1047
1049
|
} | undefined;
|
|
1048
1050
|
} | undefined;
|
|
1051
|
+
rawEnvValues?: boolean | undefined;
|
|
1049
1052
|
}>>;
|
|
1050
1053
|
legacy: z.ZodDefault<z.ZodObject<{
|
|
1051
1054
|
collections: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -1283,6 +1286,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1283
1286
|
strictDynamic?: boolean | undefined;
|
|
1284
1287
|
} | undefined;
|
|
1285
1288
|
};
|
|
1289
|
+
rawEnvValues: boolean;
|
|
1286
1290
|
fonts?: ({
|
|
1287
1291
|
name: string;
|
|
1288
1292
|
cssVariable: string;
|
|
@@ -1611,6 +1615,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1611
1615
|
strictDynamic?: boolean | undefined;
|
|
1612
1616
|
} | undefined;
|
|
1613
1617
|
} | undefined;
|
|
1618
|
+
rawEnvValues?: boolean | undefined;
|
|
1614
1619
|
} | undefined;
|
|
1615
1620
|
legacy?: {
|
|
1616
1621
|
collections?: boolean | undefined;
|
|
@@ -1767,6 +1772,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
1767
1772
|
strictDynamic?: boolean | undefined;
|
|
1768
1773
|
} | undefined;
|
|
1769
1774
|
};
|
|
1775
|
+
rawEnvValues: boolean;
|
|
1770
1776
|
fonts?: ({
|
|
1771
1777
|
name: string;
|
|
1772
1778
|
cssVariable: string;
|
|
@@ -2095,6 +2101,7 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: stri
|
|
|
2095
2101
|
strictDynamic?: boolean | undefined;
|
|
2096
2102
|
} | undefined;
|
|
2097
2103
|
} | undefined;
|
|
2104
|
+
rawEnvValues?: boolean | undefined;
|
|
2098
2105
|
} | undefined;
|
|
2099
2106
|
legacy?: {
|
|
2100
2107
|
collections?: boolean | undefined;
|
|
@@ -1,13 +1,19 @@
|
|
|
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
5
|
import { getContentPaths } from "../../content/index.js";
|
|
5
6
|
import createPreferences from "../../preferences/index.js";
|
|
6
7
|
import { markdownContentEntryType } from "../../vite-plugin-markdown/content-entry-type.js";
|
|
7
8
|
import { getDefaultClientDirectives } from "../client-directive/index.js";
|
|
8
9
|
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from "./../constants.js";
|
|
9
10
|
import { AstroError, AstroErrorData } from "../errors/index.js";
|
|
10
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
formatTOMLError,
|
|
13
|
+
formatYAMLException,
|
|
14
|
+
isTOMLError,
|
|
15
|
+
isYAMLException
|
|
16
|
+
} from "../errors/utils.js";
|
|
11
17
|
import { AstroTimer } from "./timer.js";
|
|
12
18
|
import { loadTSConfig } from "./tsconfig.js";
|
|
13
19
|
function createBaseSettings(config) {
|
|
@@ -86,6 +92,31 @@ function createBaseSettings(config) {
|
|
|
86
92
|
});
|
|
87
93
|
}
|
|
88
94
|
}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
extensions: [".toml"],
|
|
98
|
+
getEntryInfo({ contents, fileUrl }) {
|
|
99
|
+
try {
|
|
100
|
+
const data = toml.parse(contents);
|
|
101
|
+
const rawData = contents;
|
|
102
|
+
return { data, rawData };
|
|
103
|
+
} catch (e) {
|
|
104
|
+
const pathRelToContentDir = path.relative(
|
|
105
|
+
fileURLToPath(contentDir),
|
|
106
|
+
fileURLToPath(fileUrl)
|
|
107
|
+
);
|
|
108
|
+
const formattedError = isTOMLError(e) ? formatTOMLError(e) : new Error("contains invalid TOML.");
|
|
109
|
+
throw new AstroError({
|
|
110
|
+
...AstroErrorData.DataCollectionEntryParseError,
|
|
111
|
+
message: AstroErrorData.DataCollectionEntryParseError.message(
|
|
112
|
+
pathRelToContentDir,
|
|
113
|
+
formattedError.message
|
|
114
|
+
),
|
|
115
|
+
stack: formattedError.stack,
|
|
116
|
+
location: "loc" in formattedError ? { file: fileUrl.pathname, ...formattedError.loc } : { file: fileUrl.pathname }
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
89
120
|
}
|
|
90
121
|
],
|
|
91
122
|
renderers: [],
|
package/dist/core/constants.js
CHANGED
package/dist/core/create-vite.js
CHANGED
|
@@ -85,7 +85,12 @@ async function createVite(commandConfig, { settings, logger, mode, command, fs =
|
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
87
|
const srcDirPattern = convertPathToPattern(fileURLToPath(settings.config.srcDir));
|
|
88
|
-
const
|
|
88
|
+
const astroEnvLoader = createEnvLoader(mode, settings.config, false);
|
|
89
|
+
const importMetaEnvLoader = createEnvLoader(
|
|
90
|
+
mode,
|
|
91
|
+
settings.config,
|
|
92
|
+
settings.config.experimental.rawEnvValues
|
|
93
|
+
);
|
|
89
94
|
const commonConfig = {
|
|
90
95
|
// Tell Vite not to combine config from vite.config.js with our provided inline config
|
|
91
96
|
configFile: false,
|
|
@@ -111,8 +116,8 @@ async function createVite(commandConfig, { settings, logger, mode, command, fs =
|
|
|
111
116
|
// the build to run very slow as the filewatcher is triggered often.
|
|
112
117
|
command === "dev" && vitePluginAstroServer({ settings, logger, fs, routesList, manifest }),
|
|
113
118
|
// manifest is only required in dev mode, where it gets created before a Vite instance is created, and get passed to this function
|
|
114
|
-
importMetaEnv({ envLoader }),
|
|
115
|
-
astroEnv({ settings, sync, envLoader }),
|
|
119
|
+
importMetaEnv({ envLoader: importMetaEnvLoader }),
|
|
120
|
+
astroEnv({ settings, sync, envLoader: astroEnvLoader }),
|
|
116
121
|
markdownVitePlugin({ settings, logger }),
|
|
117
122
|
htmlVitePlugin(),
|
|
118
123
|
astroPostprocessVitePlugin(),
|
package/dist/core/dev/dev.js
CHANGED
|
@@ -22,7 +22,7 @@ async function dev(inlineConfig) {
|
|
|
22
22
|
await telemetry.record([]);
|
|
23
23
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
24
24
|
const logger = restart.container.logger;
|
|
25
|
-
const currentVersion = "5.
|
|
25
|
+
const currentVersion = "5.12.0";
|
|
26
26
|
const isPrerelease = currentVersion.includes("-");
|
|
27
27
|
if (!isPrerelease) {
|
|
28
28
|
try {
|
|
@@ -1597,7 +1597,7 @@ export declare const ContentCollectionTypeMismatchError: {
|
|
|
1597
1597
|
* @docs
|
|
1598
1598
|
* @message `COLLECTION_ENTRY_NAME` failed to parse.
|
|
1599
1599
|
* @description
|
|
1600
|
-
* Collection entries of `type: 'data'` must return an object with valid JSON (for `.json` entries)
|
|
1600
|
+
* Collection entries of `type: 'data'` must return an object with valid JSON (for `.json` entries), YAML (for `.yaml` entries) or TOML (for `.toml` entries).
|
|
1601
1601
|
*/
|
|
1602
1602
|
export declare const DataCollectionEntryParseError: {
|
|
1603
1603
|
name: string;
|
|
@@ -1634,7 +1634,7 @@ export declare const UnsupportedConfigTransformError: {
|
|
|
1634
1634
|
* @see
|
|
1635
1635
|
* - [Passing a `parser` to the `file` loader](https://docs.astro.build/en/guides/content-collections/#parser-function)
|
|
1636
1636
|
* @description
|
|
1637
|
-
* The `file` loader can’t determine which parser to use. Please provide a custom parser (e.g. `
|
|
1637
|
+
* The `file` loader can’t determine which parser to use. Please provide a custom parser (e.g. `csv-parse`) to create a collection from your file type.
|
|
1638
1638
|
*/
|
|
1639
1639
|
export declare const FileParserNotFound: {
|
|
1640
1640
|
name: string;
|
|
@@ -635,7 +635,7 @@ const DataCollectionEntryParseError = {
|
|
|
635
635
|
message(entryId, errorMessage) {
|
|
636
636
|
return `**${entryId}** failed to parse: ${errorMessage}`;
|
|
637
637
|
},
|
|
638
|
-
hint: "Ensure your data entry is an object with valid JSON (for `.json` entries)
|
|
638
|
+
hint: "Ensure your data entry is an object with valid JSON (for `.json` entries), YAML (for `.yaml` entries) or TOML (for `.toml` entries)."
|
|
639
639
|
};
|
|
640
640
|
const DuplicateContentEntrySlugError = {
|
|
641
641
|
name: "DuplicateContentEntrySlugError",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { YAMLException } from 'js-yaml';
|
|
2
|
+
import type { TomlError } from 'smol-toml';
|
|
2
3
|
import type { ErrorPayload as ViteErrorPayload } from 'vite';
|
|
3
4
|
/**
|
|
4
5
|
* Get the line and character based on the offset
|
|
@@ -12,6 +13,9 @@ export declare function positionAt(offset: number, text: string): {
|
|
|
12
13
|
export declare function isYAMLException(err: unknown): err is YAMLException;
|
|
13
14
|
/** Format YAML exceptions as Vite errors */
|
|
14
15
|
export declare function formatYAMLException(e: YAMLException): ViteErrorPayload['err'];
|
|
16
|
+
export declare function isTOMLError(err: unknown): err is TomlError;
|
|
17
|
+
/** Format TOML exceptions as Vite errors */
|
|
18
|
+
export declare function formatTOMLError(e: TomlError): ViteErrorPayload['err'];
|
|
15
19
|
/** Coalesce any throw variable to an Error instance. */
|
|
16
20
|
export declare function createSafeError(err: any): Error;
|
|
17
21
|
export declare function normalizeLF(code: string): string;
|
|
@@ -57,6 +57,18 @@ function formatYAMLException(e) {
|
|
|
57
57
|
stack: e.stack ?? ""
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
+
function isTOMLError(err) {
|
|
61
|
+
return err instanceof Error && err.name === "TomlError";
|
|
62
|
+
}
|
|
63
|
+
function formatTOMLError(e) {
|
|
64
|
+
return {
|
|
65
|
+
name: e.name,
|
|
66
|
+
id: e.name,
|
|
67
|
+
loc: { line: e.line + 1, column: e.column },
|
|
68
|
+
message: e.message,
|
|
69
|
+
stack: e.stack ?? ""
|
|
70
|
+
};
|
|
71
|
+
}
|
|
60
72
|
function createSafeError(err) {
|
|
61
73
|
if (err instanceof Error || err?.name && err.message) {
|
|
62
74
|
return err;
|
|
@@ -71,7 +83,9 @@ function normalizeLF(code) {
|
|
|
71
83
|
}
|
|
72
84
|
export {
|
|
73
85
|
createSafeError,
|
|
86
|
+
formatTOMLError,
|
|
74
87
|
formatYAMLException,
|
|
88
|
+
isTOMLError,
|
|
75
89
|
isYAMLException,
|
|
76
90
|
normalizeLF,
|
|
77
91
|
positionAt
|
package/dist/core/messages.js
CHANGED
|
@@ -37,7 +37,7 @@ function serverStart({
|
|
|
37
37
|
host,
|
|
38
38
|
base
|
|
39
39
|
}) {
|
|
40
|
-
const version = "5.
|
|
40
|
+
const version = "5.12.0";
|
|
41
41
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
42
42
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
43
43
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -274,7 +274,7 @@ function printHelp({
|
|
|
274
274
|
message.push(
|
|
275
275
|
linebreak(),
|
|
276
276
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
277
|
-
`v${"5.
|
|
277
|
+
`v${"5.12.0"}`
|
|
278
278
|
)} ${headline}`
|
|
279
279
|
);
|
|
280
280
|
}
|
package/dist/env/env-loader.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AstroConfig } from '../types/public/index.js';
|
|
2
|
-
export declare const createEnvLoader: (mode: string, config: AstroConfig) => {
|
|
2
|
+
export declare const createEnvLoader: (mode: string, config: AstroConfig, useRawValues: boolean) => {
|
|
3
3
|
get: () => Record<string, string>;
|
|
4
4
|
getPrivateEnv: () => Record<string, string>;
|
|
5
5
|
};
|
package/dist/env/env-loader.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fileURLToPath } from "node:url";
|
|
2
2
|
import { loadEnv } from "vite";
|
|
3
3
|
const isValidIdentifierRe = /^[_$a-zA-Z][\w$]*$/;
|
|
4
|
-
function getPrivateEnv(fullEnv, astroConfig) {
|
|
4
|
+
function getPrivateEnv(fullEnv, astroConfig, useRawValues) {
|
|
5
5
|
const viteConfig = astroConfig.vite;
|
|
6
6
|
let envPrefixes = ["PUBLIC_"];
|
|
7
7
|
if (viteConfig.envPrefix) {
|
|
@@ -15,7 +15,7 @@ function getPrivateEnv(fullEnv, astroConfig) {
|
|
|
15
15
|
if (typeof value !== "string") {
|
|
16
16
|
value = `${value}`;
|
|
17
17
|
}
|
|
18
|
-
if (value === "0" || value === "1" || value === "true" || value === "false") {
|
|
18
|
+
if (!useRawValues && (value === "0" || value === "1" || value === "true" || value === "false")) {
|
|
19
19
|
privateEnv[key] = value;
|
|
20
20
|
} else {
|
|
21
21
|
privateEnv[key] = `process.env.${key}`;
|
|
@@ -27,9 +27,9 @@ function getPrivateEnv(fullEnv, astroConfig) {
|
|
|
27
27
|
}
|
|
28
28
|
return privateEnv;
|
|
29
29
|
}
|
|
30
|
-
const createEnvLoader = (mode, config) => {
|
|
30
|
+
const createEnvLoader = (mode, config, useRawValues) => {
|
|
31
31
|
const loaded = loadEnv(mode, config.vite.envDir ?? fileURLToPath(config.root), "");
|
|
32
|
-
const privateEnv = getPrivateEnv(loaded, config);
|
|
32
|
+
const privateEnv = getPrivateEnv(loaded, config, useRawValues);
|
|
33
33
|
return {
|
|
34
34
|
get: () => loaded,
|
|
35
35
|
getPrivateEnv: () => privateEnv
|
|
@@ -2307,6 +2307,24 @@ export interface ViteUserConfig extends OriginalViteUserConfig {
|
|
|
2307
2307
|
*
|
|
2308
2308
|
*/
|
|
2309
2309
|
liveContentCollections?: boolean;
|
|
2310
|
+
/**
|
|
2311
|
+
* @name experimental.rawEnvValues
|
|
2312
|
+
* @type {boolean}
|
|
2313
|
+
* @default `false`
|
|
2314
|
+
* @version 5.12
|
|
2315
|
+
* @description
|
|
2316
|
+
*
|
|
2317
|
+
* Disables coercion of `import.meta.env` values that are populated from `process.env`, allowing you to use the raw value.
|
|
2318
|
+
*
|
|
2319
|
+
* By default, Astro converts your environment variables used through `import.meta.env` in some cases, and this can prevent
|
|
2320
|
+
* access to some values such as the strings `"true"` (which is converted to a boolean value), and `"1"` (which is converted
|
|
2321
|
+
* to a number).
|
|
2322
|
+
*
|
|
2323
|
+
* This flag aligns `import.meta.env`'s behavior in Astro with [Vite](https://vite.dev/guide/env-and-mode.html#env-variables).
|
|
2324
|
+
*
|
|
2325
|
+
* See the [experimental raw environment variables guide](https://docs.astro.build/en/reference/experimental-flags/raw-env-values/) for more information.
|
|
2326
|
+
*/
|
|
2327
|
+
rawEnvValues?: boolean;
|
|
2310
2328
|
};
|
|
2311
2329
|
}
|
|
2312
2330
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.12.0",
|
|
4
4
|
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "withastro",
|
|
@@ -141,6 +141,7 @@
|
|
|
141
141
|
"rehype": "^13.0.2",
|
|
142
142
|
"semver": "^7.7.1",
|
|
143
143
|
"shiki": "^3.2.1",
|
|
144
|
+
"smol-toml": "^1.3.4",
|
|
144
145
|
"tinyexec": "^0.3.2",
|
|
145
146
|
"tinyglobby": "^0.2.12",
|
|
146
147
|
"tsconfck": "^3.1.5",
|
|
@@ -157,9 +158,9 @@
|
|
|
157
158
|
"zod": "^3.24.2",
|
|
158
159
|
"zod-to-json-schema": "^3.24.5",
|
|
159
160
|
"zod-to-ts": "^1.2.0",
|
|
160
|
-
"@astrojs/
|
|
161
|
+
"@astrojs/markdown-remark": "6.3.3",
|
|
161
162
|
"@astrojs/telemetry": "3.3.0",
|
|
162
|
-
"@astrojs/
|
|
163
|
+
"@astrojs/internal-helpers": "0.6.1"
|
|
163
164
|
},
|
|
164
165
|
"optionalDependencies": {
|
|
165
166
|
"sharp": "^0.33.3"
|