astro 2.8.0 → 2.8.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/{core → cli}/add/index.d.ts +5 -4
- package/dist/{core → cli}/add/index.js +11 -10
- package/dist/cli/docs/index.d.ts +6 -0
- package/dist/cli/docs/index.js +18 -0
- package/dist/cli/index.js +27 -77
- package/dist/cli/info/index.d.ts +7 -0
- package/dist/cli/info/index.js +45 -0
- package/dist/cli/{telemetry.d.ts → telemetry/index.d.ts} +2 -1
- package/dist/cli/{telemetry.js → telemetry/index.js} +2 -2
- package/dist/config/index.js +1 -4
- package/dist/content/vite-plugin-content-virtual-mod.js +2 -2
- package/dist/core/config/config.d.ts +0 -2
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/dev/restart.js +0 -1
- package/dist/core/messages.js +2 -2
- package/package.json +1 -1
- /package/dist/{core → cli}/add/babel.d.ts +0 -0
- /package/dist/{core → cli}/add/babel.js +0 -0
- /package/dist/{core → cli}/add/imports.d.ts +0 -0
- /package/dist/{core → cli}/add/imports.js +0 -0
- /package/dist/{core → cli}/add/wrapper.d.ts +0 -0
- /package/dist/{core → cli}/add/wrapper.js +0 -0
- /package/dist/cli/{open.d.ts → docs/open.d.ts} +0 -0
- /package/dist/cli/{open.js → docs/open.js} +0 -0
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import type yargs from 'yargs-parser';
|
|
2
|
-
import { type LogOptions } from '
|
|
3
|
-
|
|
2
|
+
import { type LogOptions } from '../../core/logger/core.js';
|
|
3
|
+
interface AddOptions {
|
|
4
4
|
logging: LogOptions;
|
|
5
5
|
flags: yargs.Arguments;
|
|
6
6
|
cwd?: string;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
interface IntegrationInfo {
|
|
9
9
|
id: string;
|
|
10
10
|
packageName: string;
|
|
11
11
|
dependencies: [name: string, version: string][];
|
|
12
12
|
type: 'integration' | 'adapter';
|
|
13
13
|
}
|
|
14
|
-
export
|
|
14
|
+
export declare function add(names: string[], { cwd, flags, logging }: AddOptions): Promise<void>;
|
|
15
15
|
export declare function validateIntegrations(integrations: string[]): Promise<IntegrationInfo[]>;
|
|
16
|
+
export {};
|
|
@@ -8,18 +8,18 @@ import path from "path";
|
|
|
8
8
|
import preferredPM from "preferred-pm";
|
|
9
9
|
import prompts from "prompts";
|
|
10
10
|
import { fileURLToPath, pathToFileURL } from "url";
|
|
11
|
-
import { loadTSConfig, resolveConfigPath } from "
|
|
11
|
+
import { loadTSConfig, resolveConfigPath } from "../../core/config/index.js";
|
|
12
12
|
import {
|
|
13
13
|
defaultTSConfig,
|
|
14
14
|
presets,
|
|
15
15
|
updateTSConfigForFramework
|
|
16
|
-
} from "
|
|
17
|
-
import { debug, info } from "
|
|
18
|
-
import * as msg from "
|
|
19
|
-
import { printHelp } from "
|
|
20
|
-
import { appendForwardSlash } from "
|
|
21
|
-
import { apply as applyPolyfill } from "
|
|
22
|
-
import { parseNpmName } from "
|
|
16
|
+
} from "../../core/config/tsconfig.js";
|
|
17
|
+
import { debug, info } from "../../core/logger/core.js";
|
|
18
|
+
import * as msg from "../../core/messages.js";
|
|
19
|
+
import { printHelp } from "../../core/messages.js";
|
|
20
|
+
import { appendForwardSlash } from "../../core/path.js";
|
|
21
|
+
import { apply as applyPolyfill } from "../../core/polyfill.js";
|
|
22
|
+
import { parseNpmName } from "../../core/util.js";
|
|
23
23
|
import { generate, parse, t, visit } from "./babel.js";
|
|
24
24
|
import { ensureImport } from "./imports.js";
|
|
25
25
|
import { wrapDefaultExport } from "./wrapper.js";
|
|
@@ -637,7 +637,8 @@ async function validateIntegrations(integrations) {
|
|
|
637
637
|
const meta = pkgJson["peerDependenciesMeta"] || {};
|
|
638
638
|
for (const peer in pkgJson["peerDependencies"]) {
|
|
639
639
|
const optional = ((_a = meta[peer]) == null ? void 0 : _a.optional) || false;
|
|
640
|
-
|
|
640
|
+
const isAstro = peer === "astro";
|
|
641
|
+
if (!optional && !isAstro) {
|
|
641
642
|
dependencies.push([peer, pkgJson["peerDependencies"][peer]]);
|
|
642
643
|
}
|
|
643
644
|
}
|
|
@@ -824,6 +825,6 @@ async function setupIntegrationConfig(opts) {
|
|
|
824
825
|
}
|
|
825
826
|
}
|
|
826
827
|
export {
|
|
827
|
-
add
|
|
828
|
+
add,
|
|
828
829
|
validateIntegrations
|
|
829
830
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { printHelp } from "../../core/messages.js";
|
|
2
|
+
import { openInBrowser } from "./open.js";
|
|
3
|
+
async function docs({ flags }) {
|
|
4
|
+
if (flags.help || flags.h) {
|
|
5
|
+
printHelp({
|
|
6
|
+
commandName: "astro docs",
|
|
7
|
+
tables: {
|
|
8
|
+
Flags: [["--help (-h)", "See all available flags."]]
|
|
9
|
+
},
|
|
10
|
+
description: `Launches the Astro Docs website directly from the terminal.`
|
|
11
|
+
});
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
return await openInBrowser("https://docs.astro.build/");
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
docs
|
|
18
|
+
};
|
package/dist/cli/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import * as colors from "kleur/colors";
|
|
3
|
-
import { arch, platform } from "node:os";
|
|
4
3
|
import yargs from "yargs-parser";
|
|
5
4
|
import { ZodError } from "zod";
|
|
6
5
|
import {
|
|
@@ -17,7 +16,6 @@ import { enableVerboseLogging, nodeLogDestination } from "../core/logger/node.js
|
|
|
17
16
|
import { formatConfigErrorMessage, formatErrorMessage, printHelp } from "../core/messages.js";
|
|
18
17
|
import * as event from "../events/index.js";
|
|
19
18
|
import { eventConfigError, eventError, telemetry } from "../events/index.js";
|
|
20
|
-
import { openInBrowser } from "./open.js";
|
|
21
19
|
function printAstroHelp() {
|
|
22
20
|
printHelp({
|
|
23
21
|
commandName: "astro",
|
|
@@ -48,52 +46,10 @@ function printAstroHelp() {
|
|
|
48
46
|
}
|
|
49
47
|
});
|
|
50
48
|
}
|
|
51
|
-
|
|
49
|
+
function printVersion() {
|
|
52
50
|
console.log();
|
|
53
51
|
console.log(` ${colors.bgGreen(colors.black(` astro `))} ${colors.green(`v${ASTRO_VERSION}`)}`);
|
|
54
52
|
}
|
|
55
|
-
async function printInfo({
|
|
56
|
-
cwd,
|
|
57
|
-
flags,
|
|
58
|
-
logging
|
|
59
|
-
}) {
|
|
60
|
-
var _a;
|
|
61
|
-
const whichPm = await import("which-pm");
|
|
62
|
-
const packageManager = await whichPm.default(process.cwd());
|
|
63
|
-
let adapter = "Couldn't determine.";
|
|
64
|
-
let integrations = [];
|
|
65
|
-
const MAX_PADDING = 25;
|
|
66
|
-
function printRow(label, value) {
|
|
67
|
-
const padding = MAX_PADDING - label.length;
|
|
68
|
-
console.log(`${colors.bold(label)}` + " ".repeat(padding) + `${colors.green(value)}`);
|
|
69
|
-
}
|
|
70
|
-
try {
|
|
71
|
-
const { userConfig } = await openConfig({
|
|
72
|
-
cwd,
|
|
73
|
-
flags,
|
|
74
|
-
cmd: "info",
|
|
75
|
-
logging
|
|
76
|
-
});
|
|
77
|
-
if ((_a = userConfig.adapter) == null ? void 0 : _a.name) {
|
|
78
|
-
adapter = userConfig.adapter.name;
|
|
79
|
-
}
|
|
80
|
-
if (userConfig.integrations) {
|
|
81
|
-
integrations = ((userConfig == null ? void 0 : userConfig.integrations) ?? []).filter(Boolean).flat().map((i) => i == null ? void 0 : i.name);
|
|
82
|
-
}
|
|
83
|
-
} catch (_e) {
|
|
84
|
-
}
|
|
85
|
-
console.log();
|
|
86
|
-
printRow("Astro version", `v${ASTRO_VERSION}`);
|
|
87
|
-
printRow("Package manager", packageManager.name);
|
|
88
|
-
printRow("Platform", platform());
|
|
89
|
-
printRow("Architecture", arch());
|
|
90
|
-
printRow("Adapter", adapter);
|
|
91
|
-
let integrationsString = "None or couldn't determine.";
|
|
92
|
-
if (integrations.length > 0) {
|
|
93
|
-
integrationsString = integrations.join(", ");
|
|
94
|
-
}
|
|
95
|
-
printRow("Integrations", integrationsString);
|
|
96
|
-
}
|
|
97
53
|
function resolveCommand(flags) {
|
|
98
54
|
const cmd = flags._[2];
|
|
99
55
|
if (flags.version)
|
|
@@ -131,22 +87,35 @@ async function handleConfigError(e, { cmd, cwd, flags, logging }) {
|
|
|
131
87
|
async function runCommand(cmd, flags) {
|
|
132
88
|
var _a;
|
|
133
89
|
const root = flags.root;
|
|
134
|
-
let logging = {
|
|
135
|
-
dest: nodeLogDestination,
|
|
136
|
-
level: "info"
|
|
137
|
-
};
|
|
138
90
|
switch (cmd) {
|
|
139
91
|
case "help":
|
|
140
92
|
printAstroHelp();
|
|
141
|
-
return
|
|
93
|
+
return;
|
|
142
94
|
case "version":
|
|
143
|
-
|
|
144
|
-
return
|
|
95
|
+
printVersion();
|
|
96
|
+
return;
|
|
145
97
|
case "info": {
|
|
146
|
-
|
|
147
|
-
|
|
98
|
+
const { printInfo } = await import("./info/index.js");
|
|
99
|
+
await printInfo({ cwd: root, flags });
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
case "docs": {
|
|
103
|
+
telemetry.record(event.eventCliSession(cmd));
|
|
104
|
+
const { docs } = await import("./docs/index.js");
|
|
105
|
+
await docs({ flags });
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
case "telemetry": {
|
|
109
|
+
const { update } = await import("./telemetry/index.js");
|
|
110
|
+
const subcommand = (_a = flags._[3]) == null ? void 0 : _a.toString();
|
|
111
|
+
await update(subcommand, { flags });
|
|
112
|
+
return;
|
|
148
113
|
}
|
|
149
114
|
}
|
|
115
|
+
const logging = {
|
|
116
|
+
dest: nodeLogDestination,
|
|
117
|
+
level: "info"
|
|
118
|
+
};
|
|
150
119
|
if (flags.verbose) {
|
|
151
120
|
logging.level = "debug";
|
|
152
121
|
enableVerboseLogging();
|
|
@@ -155,29 +124,11 @@ async function runCommand(cmd, flags) {
|
|
|
155
124
|
}
|
|
156
125
|
switch (cmd) {
|
|
157
126
|
case "add": {
|
|
158
|
-
const { default: add } = await import("../core/add/index.js");
|
|
159
127
|
telemetry.record(event.eventCliSession(cmd));
|
|
128
|
+
const { add } = await import("./add/index.js");
|
|
160
129
|
const packages = flags._.slice(3);
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
case "docs": {
|
|
164
|
-
telemetry.record(event.eventCliSession(cmd));
|
|
165
|
-
if (flags.help || flags.h) {
|
|
166
|
-
printHelp({
|
|
167
|
-
commandName: "astro docs",
|
|
168
|
-
tables: {
|
|
169
|
-
Flags: [["--help (-h)", "See all available flags."]]
|
|
170
|
-
},
|
|
171
|
-
description: `Launches the Astro Docs website directly from the terminal.`
|
|
172
|
-
});
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
return await openInBrowser("https://docs.astro.build/");
|
|
176
|
-
}
|
|
177
|
-
case "telemetry": {
|
|
178
|
-
const telemetryHandler = await import("./telemetry.js");
|
|
179
|
-
const subcommand = (_a = flags._[3]) == null ? void 0 : _a.toString();
|
|
180
|
-
return await telemetryHandler.update(subcommand, { flags });
|
|
130
|
+
await add(packages, { cwd: root, flags, logging });
|
|
131
|
+
return;
|
|
181
132
|
}
|
|
182
133
|
}
|
|
183
134
|
if (!process.env.NODE_ENV) {
|
|
@@ -186,8 +137,7 @@ async function runCommand(cmd, flags) {
|
|
|
186
137
|
let { astroConfig: initialAstroConfig, userConfig: initialUserConfig } = await openConfig({
|
|
187
138
|
cwd: root,
|
|
188
139
|
flags,
|
|
189
|
-
cmd
|
|
190
|
-
logging
|
|
140
|
+
cmd
|
|
191
141
|
}).catch(async (e) => {
|
|
192
142
|
await handleConfigError(e, { cmd, cwd: root, flags, logging });
|
|
193
143
|
return {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as colors from "kleur/colors";
|
|
2
|
+
import { arch, platform } from "node:os";
|
|
3
|
+
import whichPm from "which-pm";
|
|
4
|
+
import { openConfig } from "../../core/config/index.js";
|
|
5
|
+
import { ASTRO_VERSION } from "../../core/constants.js";
|
|
6
|
+
async function printInfo({ cwd, flags }) {
|
|
7
|
+
var _a;
|
|
8
|
+
const packageManager = await whichPm(process.cwd());
|
|
9
|
+
let adapter = "Couldn't determine.";
|
|
10
|
+
let integrations = [];
|
|
11
|
+
const MAX_PADDING = 25;
|
|
12
|
+
function printRow(label, value) {
|
|
13
|
+
const padding = MAX_PADDING - label.length;
|
|
14
|
+
console.log(`${colors.bold(label)}` + " ".repeat(padding) + `${colors.green(value)}`);
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
const { userConfig } = await openConfig({
|
|
18
|
+
cwd,
|
|
19
|
+
flags,
|
|
20
|
+
cmd: "info"
|
|
21
|
+
});
|
|
22
|
+
if ((_a = userConfig.adapter) == null ? void 0 : _a.name) {
|
|
23
|
+
adapter = userConfig.adapter.name;
|
|
24
|
+
}
|
|
25
|
+
if (userConfig.integrations) {
|
|
26
|
+
integrations = ((userConfig == null ? void 0 : userConfig.integrations) ?? []).filter(Boolean).flat().map((i) => i == null ? void 0 : i.name);
|
|
27
|
+
}
|
|
28
|
+
} catch (_e) {
|
|
29
|
+
}
|
|
30
|
+
console.log();
|
|
31
|
+
const packageManagerName = (packageManager == null ? void 0 : packageManager.name) ?? "Couldn't determine.";
|
|
32
|
+
printRow("Astro version", `v${ASTRO_VERSION}`);
|
|
33
|
+
printRow("Package manager", packageManagerName);
|
|
34
|
+
printRow("Platform", platform());
|
|
35
|
+
printRow("Architecture", arch());
|
|
36
|
+
printRow("Adapter", adapter);
|
|
37
|
+
let integrationsString = "None or couldn't determine.";
|
|
38
|
+
if (integrations.length > 0) {
|
|
39
|
+
integrationsString = integrations.join(", ");
|
|
40
|
+
}
|
|
41
|
+
printRow("Integrations", integrationsString);
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
printInfo
|
|
45
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as msg from "
|
|
2
|
-
import { telemetry } from "
|
|
1
|
+
import * as msg from "../../core/messages.js";
|
|
2
|
+
import { telemetry } from "../../events/index.js";
|
|
3
3
|
async function update(subcommand, { flags }) {
|
|
4
4
|
const isValid = ["enable", "disable", "reset"].includes(subcommand);
|
|
5
5
|
if (flags.help || flags.h || !isValid) {
|
package/dist/config/index.js
CHANGED
|
@@ -25,10 +25,7 @@ function getViteConfig(inlineConfig) {
|
|
|
25
25
|
dest: nodeLogDestination,
|
|
26
26
|
level: "info"
|
|
27
27
|
};
|
|
28
|
-
const { astroConfig: config } = await openConfig({
|
|
29
|
-
cmd,
|
|
30
|
-
logging
|
|
31
|
-
});
|
|
28
|
+
const { astroConfig: config } = await openConfig({ cmd });
|
|
32
29
|
const settings = createSettings(config, inlineConfig.root);
|
|
33
30
|
await runHookConfigSetup({ settings, command: cmd, logging });
|
|
34
31
|
const viteConfig = await createVite(
|
|
@@ -168,8 +168,8 @@ function globWithUnderscoresIgnored(relContentDir, exts) {
|
|
|
168
168
|
const contentDir = appendForwardSlash(relContentDir);
|
|
169
169
|
return [
|
|
170
170
|
`${contentDir}**/*${extGlob}`,
|
|
171
|
-
`!${contentDir}_*/**${extGlob}`,
|
|
172
|
-
`!${contentDir}_*${extGlob}`
|
|
171
|
+
`!${contentDir}**/_*/**${extGlob}`,
|
|
172
|
+
`!${contentDir}**/_*${extGlob}`
|
|
173
173
|
];
|
|
174
174
|
}
|
|
175
175
|
export {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import type { Arguments as Flags } from 'yargs-parser';
|
|
3
3
|
import type { AstroConfig, AstroUserConfig, CLIFlags } from '../../@types/astro';
|
|
4
4
|
import fs from 'fs';
|
|
5
|
-
import type { LogOptions } from '../logger/core.js';
|
|
6
5
|
export declare const LEGACY_ASTRO_CONFIG_KEYS: Set<string>;
|
|
7
6
|
/** Turn raw config values into normalized values */
|
|
8
7
|
export declare function validateConfig(userConfig: any, root: string, cmd: string): Promise<AstroConfig>;
|
|
@@ -14,7 +13,6 @@ interface LoadConfigOptions {
|
|
|
14
13
|
flags?: Flags;
|
|
15
14
|
cmd: string;
|
|
16
15
|
validate?: boolean;
|
|
17
|
-
logging: LogOptions;
|
|
18
16
|
/** Invalidate when reloading a previously loaded config */
|
|
19
17
|
isRestart?: boolean;
|
|
20
18
|
fsMod?: typeof fs;
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -54,7 +54,7 @@ async function dev(settings, options) {
|
|
|
54
54
|
isRestart: options.isRestart
|
|
55
55
|
})
|
|
56
56
|
);
|
|
57
|
-
const currentVersion = "2.8.
|
|
57
|
+
const currentVersion = "2.8.1";
|
|
58
58
|
if (currentVersion.includes("-")) {
|
|
59
59
|
warn(options.logging, null, msg.prerelease({ currentVersion }));
|
|
60
60
|
}
|
package/dist/core/dev/restart.js
CHANGED
package/dist/core/messages.js
CHANGED
|
@@ -47,7 +47,7 @@ function serverStart({
|
|
|
47
47
|
base,
|
|
48
48
|
isRestart = false
|
|
49
49
|
}) {
|
|
50
|
-
const version = "2.8.
|
|
50
|
+
const version = "2.8.1";
|
|
51
51
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
52
52
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
53
53
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -233,7 +233,7 @@ function printHelp({
|
|
|
233
233
|
message.push(
|
|
234
234
|
linebreak(),
|
|
235
235
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
236
|
-
`v${"2.8.
|
|
236
|
+
`v${"2.8.1"}`
|
|
237
237
|
)} ${headline}`
|
|
238
238
|
);
|
|
239
239
|
}
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|