astro 1.0.0-beta.43 → 1.0.0-beta.44
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/cli/index.js
CHANGED
|
@@ -40,7 +40,7 @@ function printAstroHelp() {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
async function printVersion() {
|
|
43
|
-
const version = "1.0.0-beta.
|
|
43
|
+
const version = "1.0.0-beta.44";
|
|
44
44
|
console.log();
|
|
45
45
|
console.log(` ${colors.bgGreen(colors.black(` astro `))} ${colors.green(`v${version}`)}`);
|
|
46
46
|
}
|
|
@@ -83,7 +83,7 @@ async function cli(args) {
|
|
|
83
83
|
} else if (flags.silent) {
|
|
84
84
|
logging.level = "silent";
|
|
85
85
|
}
|
|
86
|
-
const telemetry = new AstroTelemetry({ version: "1.0.0-beta.
|
|
86
|
+
const telemetry = new AstroTelemetry({ version: "1.0.0-beta.44" });
|
|
87
87
|
if (cmd === "telemetry") {
|
|
88
88
|
try {
|
|
89
89
|
const subcommand = (_a = flags._[3]) == null ? void 0 : _a.toString();
|
|
@@ -97,7 +97,7 @@ async function cli(args) {
|
|
|
97
97
|
try {
|
|
98
98
|
const packages = flags._.slice(3);
|
|
99
99
|
telemetry.record(event.eventCliSession({
|
|
100
|
-
astroVersion: "1.0.0-beta.
|
|
100
|
+
astroVersion: "1.0.0-beta.44",
|
|
101
101
|
cliCommand: "add"
|
|
102
102
|
}));
|
|
103
103
|
return await add(packages, { cwd: root, flags, logging, telemetry });
|
|
@@ -108,7 +108,7 @@ async function cli(args) {
|
|
|
108
108
|
case "dev": {
|
|
109
109
|
try {
|
|
110
110
|
const { astroConfig, userConfig } = await openConfig({ cwd: root, flags, cmd });
|
|
111
|
-
telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.
|
|
111
|
+
telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.44", cliCommand: "dev" }, userConfig, flags));
|
|
112
112
|
await devServer(astroConfig, { logging, telemetry });
|
|
113
113
|
return await new Promise(() => {
|
|
114
114
|
});
|
|
@@ -119,7 +119,7 @@ async function cli(args) {
|
|
|
119
119
|
case "build": {
|
|
120
120
|
try {
|
|
121
121
|
const { astroConfig, userConfig } = await openConfig({ cwd: root, flags, cmd });
|
|
122
|
-
telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.
|
|
122
|
+
telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.44", cliCommand: "build" }, userConfig, flags));
|
|
123
123
|
return await build(astroConfig, { logging, telemetry });
|
|
124
124
|
} catch (err) {
|
|
125
125
|
return throwAndExit(err);
|
|
@@ -127,14 +127,14 @@ async function cli(args) {
|
|
|
127
127
|
}
|
|
128
128
|
case "check": {
|
|
129
129
|
const { astroConfig, userConfig } = await openConfig({ cwd: root, flags, cmd });
|
|
130
|
-
telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.
|
|
130
|
+
telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.44", cliCommand: "check" }, userConfig, flags));
|
|
131
131
|
const ret = await check(astroConfig);
|
|
132
132
|
return process.exit(ret);
|
|
133
133
|
}
|
|
134
134
|
case "preview": {
|
|
135
135
|
try {
|
|
136
136
|
const { astroConfig, userConfig } = await openConfig({ cwd: root, flags, cmd });
|
|
137
|
-
telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.
|
|
137
|
+
telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.44", cliCommand: "preview" }, userConfig, flags));
|
|
138
138
|
const server = await preview(astroConfig, { logging, telemetry });
|
|
139
139
|
return await server.closed();
|
|
140
140
|
} catch (err) {
|
|
@@ -144,7 +144,7 @@ async function cli(args) {
|
|
|
144
144
|
case "docs": {
|
|
145
145
|
try {
|
|
146
146
|
await telemetry.record(event.eventCliSession({
|
|
147
|
-
astroVersion: "1.0.0-beta.
|
|
147
|
+
astroVersion: "1.0.0-beta.44",
|
|
148
148
|
cliCommand: "docs"
|
|
149
149
|
}));
|
|
150
150
|
return await openInBrowser("https://docs.astro.build/");
|
package/dist/core/dev/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import glob from "fast-glob";
|
|
2
|
-
import path from "path";
|
|
3
1
|
import { performance } from "perf_hooks";
|
|
4
2
|
import * as vite from "vite";
|
|
5
3
|
import {
|
|
@@ -20,13 +18,19 @@ async function dev(config, options) {
|
|
|
20
18
|
await options.telemetry.record([]);
|
|
21
19
|
config = await runHookConfigSetup({ config, command: "dev" });
|
|
22
20
|
const { host, port } = config.server;
|
|
23
|
-
const
|
|
24
|
-
const clientRuntimeFilePaths = clientRuntimeScripts.map((script) => `astro/client/${path.basename(script)}`).filter((filePath) => filePath !== "astro/client/hmr.js");
|
|
21
|
+
const rendererClientEntries = config._ctx.renderers.map((r) => r.clientEntrypoint).filter(Boolean);
|
|
25
22
|
const viteConfig = await createVite({
|
|
26
23
|
mode: "development",
|
|
27
24
|
server: { host },
|
|
28
25
|
optimizeDeps: {
|
|
29
|
-
include:
|
|
26
|
+
include: [
|
|
27
|
+
"astro/client/idle.js",
|
|
28
|
+
"astro/client/load.js",
|
|
29
|
+
"astro/client/visible.js",
|
|
30
|
+
"astro/client/media.js",
|
|
31
|
+
"astro/client/only.js",
|
|
32
|
+
...rendererClientEntries
|
|
33
|
+
]
|
|
30
34
|
}
|
|
31
35
|
}, { astroConfig: config, logging: options.logging, mode: "dev" });
|
|
32
36
|
await runHookConfigDone({ config });
|
|
@@ -43,7 +47,7 @@ async function dev(config, options) {
|
|
|
43
47
|
site,
|
|
44
48
|
https: !!((_a = viteConfig.server) == null ? void 0 : _a.https)
|
|
45
49
|
}));
|
|
46
|
-
const currentVersion = "1.0.0-beta.
|
|
50
|
+
const currentVersion = "1.0.0-beta.44";
|
|
47
51
|
if (currentVersion.includes("-")) {
|
|
48
52
|
warn(options.logging, null, msg.prerelease({ currentVersion }));
|
|
49
53
|
}
|
package/dist/core/errors.js
CHANGED
|
@@ -32,6 +32,18 @@ function collectErrorMetadata(e) {
|
|
|
32
32
|
if (e.stack) {
|
|
33
33
|
e.stack = eol.lf(e.stack);
|
|
34
34
|
}
|
|
35
|
+
if (e.name === "YAMLException") {
|
|
36
|
+
const err = e;
|
|
37
|
+
err.loc = { file: e.id, line: e.mark.line, column: e.mark.column };
|
|
38
|
+
err.message = e.reason;
|
|
39
|
+
if (!err.frame) {
|
|
40
|
+
try {
|
|
41
|
+
const fileContents = fs.readFileSync(err.loc.file, "utf8");
|
|
42
|
+
err.frame = codeFrame(fileContents, err.loc);
|
|
43
|
+
} catch {
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
35
47
|
if (Array.isArray(e.errors)) {
|
|
36
48
|
const { location, pluginName, text } = e.errors[0];
|
|
37
49
|
const err = e;
|
package/dist/core/messages.js
CHANGED
|
@@ -47,7 +47,7 @@ function devStart({
|
|
|
47
47
|
https,
|
|
48
48
|
site
|
|
49
49
|
}) {
|
|
50
|
-
const version = "1.0.0-beta.
|
|
50
|
+
const version = "1.0.0-beta.44";
|
|
51
51
|
const rootPath = site ? site.pathname : "/";
|
|
52
52
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
53
53
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
@@ -207,7 +207,7 @@ function printHelp({
|
|
|
207
207
|
};
|
|
208
208
|
let message = [];
|
|
209
209
|
if (headline) {
|
|
210
|
-
message.push(linebreak(), ` ${bgGreen(black(` ${commandName} `))} ${green(`v${"1.0.0-beta.
|
|
210
|
+
message.push(linebreak(), ` ${bgGreen(black(` ${commandName} `))} ${green(`v${"1.0.0-beta.44"}`)} ${headline}`);
|
|
211
211
|
}
|
|
212
212
|
if (usage) {
|
|
213
213
|
message.push(linebreak(), ` ${green(commandName)} ${bold(usage)}`);
|
|
@@ -254,7 +254,7 @@ export interface AstroUserConfig {
|
|
|
254
254
|
* @type {string}
|
|
255
255
|
* @default `"."` (current working directory)
|
|
256
256
|
* @summary Set the project root. The project root is the directory where your Astro project (and all `src`, `public` and `package.json` files) live.
|
|
257
|
-
* @description You should only provide this option if you run the `astro` CLI commands in a directory other than the project root directory. Usually, this option is provided via the CLI instead of the
|
|
257
|
+
* @description You should only provide this option if you run the `astro` CLI commands in a directory other than the project root directory. Usually, this option is provided via the CLI instead of the [Astro config file](https://docs.astro.build/en/guides/configuring-astro/#supported-config-file-types), since Astro needs to know your project root before it can locate your config file.
|
|
258
258
|
*
|
|
259
259
|
* If you provide a relative path (ex: `--root: './my-project'`) Astro will resolve it against your current working directory.
|
|
260
260
|
*
|
|
@@ -37,12 +37,21 @@ import fs from "fs";
|
|
|
37
37
|
import matter from "gray-matter";
|
|
38
38
|
import { fileURLToPath } from "url";
|
|
39
39
|
import { pagesVirtualModuleId } from "../core/app/index.js";
|
|
40
|
+
import { collectErrorMetadata } from "../core/errors.js";
|
|
40
41
|
import { prependForwardSlash } from "../core/path.js";
|
|
41
42
|
import { resolvePages, viteID } from "../core/util.js";
|
|
42
43
|
import { PAGE_SSR_SCRIPT_ID } from "../vite-plugin-scripts/index.js";
|
|
43
44
|
import { getFileInfo } from "../vite-plugin-utils/index.js";
|
|
44
45
|
const MARKDOWN_IMPORT_FLAG = "?mdImport";
|
|
45
46
|
const MARKDOWN_CONTENT_FLAG = "?content";
|
|
47
|
+
function safeMatter(source, id) {
|
|
48
|
+
try {
|
|
49
|
+
return matter(source);
|
|
50
|
+
} catch (e) {
|
|
51
|
+
e.id = id;
|
|
52
|
+
throw collectErrorMetadata(e);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
46
55
|
function markdown({ config }) {
|
|
47
56
|
function normalizeFilename(filename) {
|
|
48
57
|
if (filename.startsWith("/@fs")) {
|
|
@@ -85,7 +94,7 @@ function markdown({ config }) {
|
|
|
85
94
|
if (id.endsWith(`.md${MARKDOWN_IMPORT_FLAG}`)) {
|
|
86
95
|
const { fileId, fileUrl } = getFileInfo(id, config);
|
|
87
96
|
const source = await fs.promises.readFile(fileId, "utf8");
|
|
88
|
-
const { data: frontmatter, content: rawContent } =
|
|
97
|
+
const { data: frontmatter, content: rawContent } = safeMatter(source, fileId);
|
|
89
98
|
return {
|
|
90
99
|
code: `
|
|
91
100
|
// Static
|
|
@@ -123,7 +132,7 @@ function markdown({ config }) {
|
|
|
123
132
|
const fileUrl = new URL(`file://${filename}`);
|
|
124
133
|
const isPage = fileUrl.pathname.startsWith(resolvePages(config).pathname);
|
|
125
134
|
const hasInjectedScript = isPage && config._ctx.scripts.some((s) => s.stage === "page-ssr");
|
|
126
|
-
let { data: frontmatter, content: markdownContent } =
|
|
135
|
+
let { data: frontmatter, content: markdownContent } = safeMatter(source, filename);
|
|
127
136
|
markdownContent = markdownContent.replace(/<\s*!--([^-->]*)(.*?)-->/gs, (whole) => `{/*${whole.replace(/\*\//g, "*\u200B/")}*/}`);
|
|
128
137
|
let renderResult = await renderMarkdown(markdownContent, __spreadProps(__spreadValues({}, renderOpts), {
|
|
129
138
|
fileURL: fileUrl
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.44",
|
|
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",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@astrojs/compiler": "^0.15.2",
|
|
70
70
|
"@astrojs/language-server": "^0.13.4",
|
|
71
|
-
"@astrojs/markdown-remark": "^0.11.
|
|
71
|
+
"@astrojs/markdown-remark": "^0.11.2",
|
|
72
72
|
"@astrojs/prism": "0.4.1",
|
|
73
73
|
"@astrojs/telemetry": "^0.1.2",
|
|
74
74
|
"@astrojs/webapi": "^0.12.0",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"strip-ansi": "^7.0.1",
|
|
120
120
|
"supports-esm": "^1.0.0",
|
|
121
121
|
"tsconfig-resolver": "^3.0.1",
|
|
122
|
-
"vite": "^2.9.
|
|
122
|
+
"vite": "^2.9.12",
|
|
123
123
|
"yargs-parser": "^21.0.1",
|
|
124
124
|
"zod": "^3.17.3"
|
|
125
125
|
},
|