astro 1.0.0-beta.52 → 1.0.0-beta.53
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 +8 -8
- package/dist/core/add/index.js +1 -1
- package/dist/core/build/static-build.js +4 -3
- package/dist/core/build/vite-plugin-analyzer.js +1 -1
- package/dist/core/dev/index.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/runtime/server/metadata.js +1 -1
- package/dist/types/vite-plugin-astro/query.d.ts +3 -2
- package/dist/vite-plugin-astro/index.js +24 -12
- package/package.json +1 -1
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.53";
|
|
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.53" });
|
|
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.53",
|
|
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.53", 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.53", 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.53", 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.53", 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.53",
|
|
148
148
|
cliCommand: "docs"
|
|
149
149
|
}));
|
|
150
150
|
return await openInBrowser("https://docs.astro.build/");
|
package/dist/core/add/index.js
CHANGED
|
@@ -289,7 +289,7 @@ async function getInstallIntegrationsCommand({
|
|
|
289
289
|
debug("add", `package manager: ${JSON.stringify(pm)}`);
|
|
290
290
|
if (!pm)
|
|
291
291
|
return null;
|
|
292
|
-
let dependencies = integrations.map((i) => [[i.packageName, null], ...i.dependencies]).flat(1).filter((dep, i, arr) => arr.findIndex((d) => d[0] === dep[0]) === i).map(([name, version]) => version === null ? name : `${name}@${version}`).sort();
|
|
292
|
+
let dependencies = integrations.map((i) => [[i.packageName, null], ...i.dependencies]).flat(1).filter((dep, i, arr) => arr.findIndex((d) => d[0] === dep[0]) === i).map(([name, version]) => version === null ? name : `${name}@${version.split(/\s*\|\|\s*/).pop()}`).sort();
|
|
293
293
|
switch (pm.name) {
|
|
294
294
|
case "npm":
|
|
295
295
|
return { pm: "npm", command: "install", flags: ["--save-dev"], dependencies };
|
|
@@ -98,12 +98,13 @@ async function ssrBuild(opts, internals, input) {
|
|
|
98
98
|
outDir: fileURLToPath(out),
|
|
99
99
|
rollupOptions: {
|
|
100
100
|
input: [],
|
|
101
|
-
output: __spreadValues({
|
|
101
|
+
output: __spreadProps(__spreadValues({
|
|
102
102
|
format: "esm",
|
|
103
|
-
entryFileNames: opts.buildConfig.serverEntry,
|
|
104
103
|
chunkFileNames: "chunks/[name].[hash].mjs",
|
|
105
104
|
assetFileNames: "assets/[name].[hash][extname]"
|
|
106
|
-
}, (_d = (_c = viteConfig.build) == null ? void 0 : _c.rollupOptions) == null ? void 0 : _d.output)
|
|
105
|
+
}, (_d = (_c = viteConfig.build) == null ? void 0 : _c.rollupOptions) == null ? void 0 : _d.output), {
|
|
106
|
+
entryFileNames: opts.buildConfig.serverEntry
|
|
107
|
+
})
|
|
107
108
|
},
|
|
108
109
|
ssr: true,
|
|
109
110
|
target: "esnext",
|
|
@@ -11,7 +11,7 @@ function vitePluginAnalyzer(astroConfig, internals) {
|
|
|
11
11
|
var _a;
|
|
12
12
|
const hoistedScripts = /* @__PURE__ */ new Set();
|
|
13
13
|
for (let i = 0; i < scripts.length; i++) {
|
|
14
|
-
const hid = `${from.replace("/@fs", "")}?astro&type=script&index=${i}`;
|
|
14
|
+
const hid = `${from.replace("/@fs", "")}?astro&type=script&index=${i}&lang.ts`;
|
|
15
15
|
hoistedScripts.add(hid);
|
|
16
16
|
}
|
|
17
17
|
if (hoistedScripts.size) {
|
package/dist/core/dev/index.js
CHANGED
|
@@ -47,7 +47,7 @@ async function dev(config, options) {
|
|
|
47
47
|
site,
|
|
48
48
|
https: !!((_a = viteConfig.server) == null ? void 0 : _a.https)
|
|
49
49
|
}));
|
|
50
|
-
const currentVersion = "1.0.0-beta.
|
|
50
|
+
const currentVersion = "1.0.0-beta.53";
|
|
51
51
|
if (currentVersion.includes("-")) {
|
|
52
52
|
warn(options.logging, null, msg.prerelease({ currentVersion }));
|
|
53
53
|
}
|
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.53";
|
|
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.53"}`)} ${headline}`);
|
|
211
211
|
}
|
|
212
212
|
if (usage) {
|
|
213
213
|
message.push(linebreak(), ` ${green(commandName)} ${bold(usage)}`);
|
|
@@ -30,7 +30,7 @@ class Metadata {
|
|
|
30
30
|
for (const metadata of this.deepMetadata()) {
|
|
31
31
|
let i = 0, pathname = metadata.mockURL.pathname;
|
|
32
32
|
while (i < metadata.hoisted.length) {
|
|
33
|
-
yield `${pathname.replace("/@fs", "")}?astro&type=script&index=${i}`;
|
|
33
|
+
yield `${pathname.replace("/@fs", "")}?astro&type=script&index=${i}&lang.ts`;
|
|
34
34
|
i++;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -6,7 +6,8 @@ export interface AstroQuery {
|
|
|
6
6
|
lang?: string;
|
|
7
7
|
raw?: boolean;
|
|
8
8
|
}
|
|
9
|
-
export
|
|
9
|
+
export interface ParsedRequestResult {
|
|
10
10
|
filename: string;
|
|
11
11
|
query: AstroQuery;
|
|
12
|
-
}
|
|
12
|
+
}
|
|
13
|
+
export declare function parseAstroRequest(id: string): ParsedRequestResult;
|
|
@@ -31,6 +31,15 @@ function astro({ config, logging }) {
|
|
|
31
31
|
let viteDevServer = null;
|
|
32
32
|
const srcRootWeb = config.srcDir.pathname.slice(config.root.pathname.length - 1);
|
|
33
33
|
const isBrowserPath = (path) => path.startsWith(srcRootWeb);
|
|
34
|
+
function resolveRelativeFromAstroParent(id, parsedFrom) {
|
|
35
|
+
const filename = normalizeFilename(parsedFrom.filename);
|
|
36
|
+
const resolvedURL = new URL(id, `file://${filename}`);
|
|
37
|
+
const resolved = resolvedURL.pathname;
|
|
38
|
+
if (isBrowserPath(resolved)) {
|
|
39
|
+
return relativeToRoot(resolved + resolvedURL.search);
|
|
40
|
+
}
|
|
41
|
+
return slash(fileURLToPath(resolvedURL)) + resolvedURL.search;
|
|
42
|
+
}
|
|
34
43
|
return {
|
|
35
44
|
name: "astro:build",
|
|
36
45
|
enforce: "pre",
|
|
@@ -41,17 +50,15 @@ function astro({ config, logging }) {
|
|
|
41
50
|
configureServer(server) {
|
|
42
51
|
viteDevServer = server;
|
|
43
52
|
},
|
|
44
|
-
async resolveId(id, from) {
|
|
53
|
+
async resolveId(id, from, opts) {
|
|
45
54
|
if (from) {
|
|
46
55
|
const parsedFrom = parseAstroRequest(from);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
return slash(fileURLToPath(resolvedURL)) + resolvedURL.search;
|
|
56
|
+
const isAstroScript = parsedFrom.query.astro && parsedFrom.query.type === "script";
|
|
57
|
+
if (isAstroScript && isRelativePath(id)) {
|
|
58
|
+
return this.resolve(resolveRelativeFromAstroParent(id, parsedFrom), from, {
|
|
59
|
+
custom: opts.custom,
|
|
60
|
+
skipSelf: true
|
|
61
|
+
});
|
|
55
62
|
}
|
|
56
63
|
}
|
|
57
64
|
const { query } = parseAstroRequest(id);
|
|
@@ -133,7 +140,12 @@ File: ${filename}`);
|
|
|
133
140
|
}
|
|
134
141
|
}
|
|
135
142
|
return {
|
|
136
|
-
code: hoistedScript.type === "inline" ? hoistedScript.code : `import "${hoistedScript.src}"
|
|
143
|
+
code: hoistedScript.type === "inline" ? hoistedScript.code : `import "${hoistedScript.src}";`,
|
|
144
|
+
meta: {
|
|
145
|
+
vite: {
|
|
146
|
+
lang: "ts"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
137
149
|
};
|
|
138
150
|
}
|
|
139
151
|
}
|
|
@@ -161,8 +173,8 @@ const $$url = ${JSON.stringify(url)};export { $$file as file, $$url as url };
|
|
|
161
173
|
}
|
|
162
174
|
let i = 0;
|
|
163
175
|
while (i < transformResult.scripts.length) {
|
|
164
|
-
deps.add(`${id}?astro&type=script&index=${i}`);
|
|
165
|
-
SUFFIX += `import "${id}?astro&type=script&index=${i}";`;
|
|
176
|
+
deps.add(`${id}?astro&type=script&index=${i}&lang.ts`);
|
|
177
|
+
SUFFIX += `import "${id}?astro&type=script&index=${i}&lang.ts";`;
|
|
166
178
|
i++;
|
|
167
179
|
}
|
|
168
180
|
SUFFIX += `
|