astro 0.26.0 → 0.26.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/astro.js +12 -4
- package/dist/@types/astro.js +0 -0
- package/dist/@types/serialize-javascript.d.js +0 -0
- package/dist/@types/shorthash.d.js +0 -0
- package/dist/adapter-ssg/index.js +0 -0
- package/dist/cli/check.js +0 -0
- package/dist/cli/index.js +1 -1
- package/dist/core/add/babel.js +0 -0
- package/dist/core/add/consts.js +0 -0
- package/dist/core/add/imports.js +0 -0
- package/dist/core/add/index.js +29 -6
- package/dist/core/add/wrapper.js +0 -0
- package/dist/core/app/common.js +0 -0
- package/dist/core/app/index.js +4 -1
- package/dist/core/app/node.js +0 -0
- package/dist/core/app/types.js +0 -0
- package/dist/core/build/add-rollup-input.js +0 -0
- package/dist/core/build/common.js +0 -0
- package/dist/core/build/generate.js +4 -1
- package/dist/core/build/index.js +34 -6
- package/dist/core/build/internal.js +0 -0
- package/dist/core/build/page-data.js +0 -0
- package/dist/core/build/static-build.js +0 -0
- package/dist/core/build/types.d.js +0 -0
- package/dist/core/build/util.js +0 -0
- package/dist/core/build/vite-plugin-hoisted-scripts.js +0 -0
- package/dist/core/build/vite-plugin-internals.js +0 -0
- package/dist/core/build/vite-plugin-pages.js +0 -0
- package/dist/core/build/vite-plugin-ssr.js +1 -0
- package/dist/core/config.js +4 -2
- package/dist/core/create-vite.js +5 -1
- package/dist/core/dev/index.js +15 -3
- package/dist/core/endpoint/dev/index.js +0 -0
- package/dist/core/endpoint/index.js +0 -0
- package/dist/core/errors.js +0 -0
- package/dist/core/logger/console.js +0 -0
- package/dist/core/logger/core.js +0 -0
- package/dist/core/logger/node.js +0 -0
- package/dist/core/messages.js +31 -6
- package/dist/core/path.js +0 -0
- package/dist/core/polyfill.js +0 -0
- package/dist/core/preview/index.js +7 -1
- package/dist/core/preview/util.js +0 -0
- package/dist/core/render/core.js +17 -1
- package/dist/core/render/dev/css.js +0 -0
- package/dist/core/render/dev/hmr.js +0 -0
- package/dist/core/render/dev/html.js +0 -0
- package/dist/core/render/dev/index.js +21 -3
- package/dist/core/render/paginate.js +3 -1
- package/dist/core/render/pretty-feed.js +0 -0
- package/dist/core/render/result.js +0 -0
- package/dist/core/render/route-cache.js +11 -2
- package/dist/core/render/rss.js +0 -0
- package/dist/core/render/script.js +0 -0
- package/dist/core/render/ssr-element.js +0 -0
- package/dist/core/render/util.js +10 -1
- package/dist/core/request.js +7 -1
- package/dist/core/routing/index.js +0 -0
- package/dist/core/routing/manifest/create.js +0 -0
- package/dist/core/routing/manifest/serialization.js +0 -0
- package/dist/core/routing/match.js +0 -0
- package/dist/core/routing/params.js +0 -0
- package/dist/core/routing/validation.js +0 -0
- package/dist/core/util.js +0 -0
- package/dist/integrations/index.js +31 -7
- package/dist/runtime/client/hmr.js +0 -0
- package/dist/runtime/client/idle.js +0 -0
- package/dist/runtime/client/load.js +0 -0
- package/dist/runtime/client/media.js +0 -0
- package/dist/runtime/client/only.js +0 -0
- package/dist/runtime/client/visible.js +0 -0
- package/dist/runtime/server/escape.js +0 -0
- package/dist/runtime/server/hydration.js +0 -0
- package/dist/runtime/server/index.js +9 -5
- package/dist/runtime/server/metadata.js +0 -0
- package/dist/runtime/server/util.js +0 -0
- package/dist/template/4xx.js +7 -1
- package/dist/template/5xx.js +8 -1
- package/dist/template/css.js +0 -0
- package/dist/types/@types/astro.d.ts +2 -2
- package/dist/types/core/messages.d.ts +1 -1
- package/dist/types/core/render/dev/index.d.ts +1 -1
- package/dist/types/core/render/route-cache.d.ts +1 -1
- package/dist/types/core/request.d.ts +1 -1
- package/dist/types/integrations/index.d.ts +6 -6
- package/dist/types/template/4xx.d.ts +1 -1
- package/dist/types/template/5xx.d.ts +1 -1
- package/dist/types/vite-plugin-astro/styles.d.ts +1 -1
- package/dist/types/vite-plugin-env/index.d.ts +1 -1
- package/dist/types/vite-plugin-integrations-container/index.d.ts +1 -1
- package/dist/vite-plugin-astro/compile.js +0 -0
- package/dist/vite-plugin-astro/hmr.js +0 -0
- package/dist/vite-plugin-astro/index.js +20 -5
- package/dist/vite-plugin-astro/query.js +0 -0
- package/dist/vite-plugin-astro/styles.js +7 -1
- package/dist/vite-plugin-astro-postprocess/index.js +5 -1
- package/dist/vite-plugin-astro-server/index.js +16 -3
- package/dist/vite-plugin-build-css/index.js +5 -1
- package/dist/vite-plugin-build-css/resolve.js +0 -0
- package/dist/vite-plugin-build-html/add-rollup-input.js +0 -0
- package/dist/vite-plugin-build-html/extract-assets.js +0 -0
- package/dist/vite-plugin-build-html/index.js +24 -3
- package/dist/vite-plugin-build-html/util.js +0 -0
- package/dist/vite-plugin-config-alias/index.js +3 -1
- package/dist/vite-plugin-env/index.js +7 -2
- package/dist/vite-plugin-integrations-container/index.js +3 -1
- package/dist/vite-plugin-jsx/index.js +21 -3
- package/dist/vite-plugin-markdown/index.js +5 -1
- package/dist/vite-plugin-scripts/index.js +0 -0
- package/package.json +2 -2
package/astro.js
CHANGED
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
const CI_INSTRUCTIONS = {
|
|
11
11
|
NETLIFY: 'https://docs.netlify.com/configure-builds/manage-dependencies/#node-js-and-javascript',
|
|
12
|
-
GITHUB_ACTIONS:
|
|
12
|
+
GITHUB_ACTIONS:
|
|
13
|
+
'https://docs.github.com/en/actions/guides/building-and-testing-nodejs#specifying-the-nodejs-version',
|
|
13
14
|
VERCEL: 'https://vercel.com/docs/runtimes#official-runtimes/node-js/node-js-version',
|
|
14
15
|
};
|
|
15
16
|
|
|
@@ -17,7 +18,10 @@ const CI_INSTRUCTIONS = {
|
|
|
17
18
|
async function main() {
|
|
18
19
|
// Check for ESM support.
|
|
19
20
|
// Load the "supports-esm" package in an way that works in both ESM & CJS.
|
|
20
|
-
let supportsESM =
|
|
21
|
+
let supportsESM =
|
|
22
|
+
typeof require !== 'undefined'
|
|
23
|
+
? require('supports-esm')
|
|
24
|
+
: (await import('supports-esm')).default;
|
|
21
25
|
|
|
22
26
|
// Check for CJS->ESM named export support.
|
|
23
27
|
// "path-to-regexp" is a real-world package that we depend on, that only
|
|
@@ -79,7 +83,9 @@ Please upgrade Node.js to a supported version: "${engines}"\n`);
|
|
|
79
83
|
break;
|
|
80
84
|
}
|
|
81
85
|
}
|
|
82
|
-
console.log(
|
|
86
|
+
console.log(
|
|
87
|
+
`${ci.name} CI Environment Detected!\nAdditional steps may be needed to set your Node.js version:`
|
|
88
|
+
);
|
|
83
89
|
console.log(`Documentation: https://docs.astro.build/guides/deploy`);
|
|
84
90
|
if (CI_INSTRUCTIONS[platform]) {
|
|
85
91
|
console.log(`${ci.name} Documentation: ${CI_INSTRUCTIONS[platform]}`);
|
|
@@ -90,4 +96,6 @@ Please upgrade Node.js to a supported version: "${engines}"\n`);
|
|
|
90
96
|
process.exit(1);
|
|
91
97
|
}
|
|
92
98
|
|
|
93
|
-
main()
|
|
99
|
+
main()
|
|
100
|
+
.then(() => process.exit(0))
|
|
101
|
+
.catch(() => process.exit(1));
|
package/dist/@types/astro.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/cli/check.js
CHANGED
|
File without changes
|
package/dist/cli/index.js
CHANGED
package/dist/core/add/babel.js
CHANGED
|
File without changes
|
package/dist/core/add/consts.js
CHANGED
|
File without changes
|
package/dist/core/add/imports.js
CHANGED
|
File without changes
|
package/dist/core/add/index.js
CHANGED
|
@@ -120,7 +120,11 @@ async function add(names, { cwd, flags, logging }) {
|
|
|
120
120
|
case UpdateResult.updated: {
|
|
121
121
|
const len = integrations.length;
|
|
122
122
|
if (integrations.find((integration) => integration.id === "tailwind")) {
|
|
123
|
-
const possibleConfigFiles = [
|
|
123
|
+
const possibleConfigFiles = [
|
|
124
|
+
"./tailwind.config.cjs",
|
|
125
|
+
"./tailwind.config.mjs",
|
|
126
|
+
"./tailwind.config.js"
|
|
127
|
+
].map((p) => fileURLToPath(new URL(p, configURL)));
|
|
124
128
|
let alreadyConfigured = false;
|
|
125
129
|
for (const possibleConfigPath of possibleConfigFiles) {
|
|
126
130
|
if (existsSync(possibleConfigPath)) {
|
|
@@ -221,7 +225,12 @@ var UpdateResult = /* @__PURE__ */ ((UpdateResult2) => {
|
|
|
221
225
|
UpdateResult2[UpdateResult2["failure"] = 3] = "failure";
|
|
222
226
|
return UpdateResult2;
|
|
223
227
|
})(UpdateResult || {});
|
|
224
|
-
async function updateAstroConfig({
|
|
228
|
+
async function updateAstroConfig({
|
|
229
|
+
configURL,
|
|
230
|
+
ast,
|
|
231
|
+
flags,
|
|
232
|
+
logging
|
|
233
|
+
}) {
|
|
225
234
|
const input = await fs.readFile(fileURLToPath(configURL), { encoding: "utf-8" });
|
|
226
235
|
let output = await generate(ast);
|
|
227
236
|
const comment = "// https://astro.build/config";
|
|
@@ -253,7 +262,12 @@ ${defaultExport}`);
|
|
|
253
262
|
diffed = diffed.replace(newContent, coloredOutput);
|
|
254
263
|
}
|
|
255
264
|
const message = `
|
|
256
|
-
${boxen(diffed, {
|
|
265
|
+
${boxen(diffed, {
|
|
266
|
+
margin: 0.5,
|
|
267
|
+
padding: 0.5,
|
|
268
|
+
borderStyle: "round",
|
|
269
|
+
title: configURL.pathname.split("/").pop()
|
|
270
|
+
})}
|
|
257
271
|
`;
|
|
258
272
|
info(logging, null, `
|
|
259
273
|
${magenta("Astro will make the following changes to your config file:")}
|
|
@@ -266,7 +280,10 @@ ${message}`);
|
|
|
266
280
|
return 2 /* cancelled */;
|
|
267
281
|
}
|
|
268
282
|
}
|
|
269
|
-
async function getInstallIntegrationsCommand({
|
|
283
|
+
async function getInstallIntegrationsCommand({
|
|
284
|
+
integrations,
|
|
285
|
+
cwd = process.cwd()
|
|
286
|
+
}) {
|
|
270
287
|
const pm = await preferredPM(cwd);
|
|
271
288
|
debug("add", `package manager: ${JSON.stringify(pm)}`);
|
|
272
289
|
if (!pm)
|
|
@@ -296,7 +313,11 @@ async function tryToInstallIntegrations({
|
|
|
296
313
|
} else {
|
|
297
314
|
const coloredOutput = `${bold(installCommand.pm)} ${installCommand.command} ${installCommand.flags.join(" ")} ${cyan(installCommand.dependencies.join(" "))}`;
|
|
298
315
|
const message = `
|
|
299
|
-
${boxen(coloredOutput, {
|
|
316
|
+
${boxen(coloredOutput, {
|
|
317
|
+
margin: 0.5,
|
|
318
|
+
padding: 0.5,
|
|
319
|
+
borderStyle: "round"
|
|
320
|
+
})}
|
|
300
321
|
`;
|
|
301
322
|
info(logging, null, `
|
|
302
323
|
${magenta("Astro will run the following command:")}
|
|
@@ -338,7 +359,9 @@ async function validateIntegrations(integrations) {
|
|
|
338
359
|
}
|
|
339
360
|
return res.json();
|
|
340
361
|
});
|
|
341
|
-
let dependencies = [
|
|
362
|
+
let dependencies = [
|
|
363
|
+
[result["name"], `^${result["version"]}`]
|
|
364
|
+
];
|
|
342
365
|
if (result["peerDependencies"]) {
|
|
343
366
|
for (const peer in result["peerDependencies"]) {
|
|
344
367
|
dependencies.push([peer, result["peerDependencies"][peer]]);
|
package/dist/core/add/wrapper.js
CHANGED
|
File without changes
|
package/dist/core/app/common.js
CHANGED
|
File without changes
|
package/dist/core/app/index.js
CHANGED
|
@@ -28,7 +28,10 @@ import { matchRoute } from "../routing/match.js";
|
|
|
28
28
|
import { render } from "../render/core.js";
|
|
29
29
|
import { call as callEndpoint } from "../endpoint/index.js";
|
|
30
30
|
import { RouteCache } from "../render/route-cache.js";
|
|
31
|
-
import {
|
|
31
|
+
import {
|
|
32
|
+
createLinkStylesheetElementSet,
|
|
33
|
+
createModuleScriptElementWithSrcSet
|
|
34
|
+
} from "../render/ssr-element.js";
|
|
32
35
|
import { prependForwardSlash } from "../path.js";
|
|
33
36
|
class App {
|
|
34
37
|
constructor(manifest) {
|
package/dist/core/app/node.js
CHANGED
|
File without changes
|
package/dist/core/app/types.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -8,7 +8,10 @@ import { prependForwardSlash } from "../../core/path.js";
|
|
|
8
8
|
import { BEFORE_HYDRATION_SCRIPT_ID } from "../../vite-plugin-scripts/index.js";
|
|
9
9
|
import { call as callEndpoint } from "../endpoint/index.js";
|
|
10
10
|
import { render } from "../render/core.js";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
createLinkStylesheetElementSet,
|
|
13
|
+
createModuleScriptElementWithSrcSet
|
|
14
|
+
} from "../render/ssr-element.js";
|
|
12
15
|
import { getOutputFilename, isBuildingToSSR } from "../util.js";
|
|
13
16
|
import { getOutFile, getOutFolder } from "./common.js";
|
|
14
17
|
import { eachPageData, getPageDataByComponent } from "./internal.js";
|
package/dist/core/build/index.js
CHANGED
|
@@ -4,13 +4,24 @@ import { apply as applyPolyfill } from "../polyfill.js";
|
|
|
4
4
|
import { performance } from "perf_hooks";
|
|
5
5
|
import * as vite from "vite";
|
|
6
6
|
import { createVite } from "../create-vite.js";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
debug,
|
|
9
|
+
info,
|
|
10
|
+
levels,
|
|
11
|
+
timerMessage,
|
|
12
|
+
warnIfUsingExperimentalSSR
|
|
13
|
+
} from "../logger/core.js";
|
|
8
14
|
import { nodeLogOptions } from "../logger/node.js";
|
|
9
15
|
import { createRouteManifest } from "../routing/index.js";
|
|
10
16
|
import { collectPagesData } from "./page-data.js";
|
|
11
17
|
import { staticBuild } from "./static-build.js";
|
|
12
18
|
import { RouteCache } from "../render/route-cache.js";
|
|
13
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
runHookBuildDone,
|
|
21
|
+
runHookBuildStart,
|
|
22
|
+
runHookConfigDone,
|
|
23
|
+
runHookConfigSetup
|
|
24
|
+
} from "../../integrations/index.js";
|
|
14
25
|
import { getTimeStat } from "./util.js";
|
|
15
26
|
import { createSafeError, isBuildingToSSR } from "../util.js";
|
|
16
27
|
import { fixViteErrorMessage } from "../errors.js";
|
|
@@ -51,7 +62,10 @@ class AstroBuilder {
|
|
|
51
62
|
debug("build", timerMessage("Vite started", this.timer.viteStart));
|
|
52
63
|
return { viteConfig, viteServer };
|
|
53
64
|
}
|
|
54
|
-
async build({
|
|
65
|
+
async build({
|
|
66
|
+
viteConfig,
|
|
67
|
+
viteServer
|
|
68
|
+
}) {
|
|
55
69
|
const { origin } = this;
|
|
56
70
|
const buildConfig = {
|
|
57
71
|
client: new URL("./client/", this.config.outDir),
|
|
@@ -106,10 +120,19 @@ class AstroBuilder {
|
|
|
106
120
|
});
|
|
107
121
|
debug("build", timerMessage("Additional assets copied", this.timer.assetsStart));
|
|
108
122
|
await viteServer.close();
|
|
109
|
-
await runHookBuildDone({
|
|
123
|
+
await runHookBuildDone({
|
|
124
|
+
config: this.config,
|
|
125
|
+
pages: pageNames,
|
|
126
|
+
routes: Object.values(allPages).map((pd) => pd.route)
|
|
127
|
+
});
|
|
110
128
|
if (this.logging.level && levels[this.logging.level] <= levels["info"]) {
|
|
111
129
|
const buildMode = isBuildingToSSR(this.config) ? "ssr" : "static";
|
|
112
|
-
await this.printStats({
|
|
130
|
+
await this.printStats({
|
|
131
|
+
logging: this.logging,
|
|
132
|
+
timeStart: this.timer.init,
|
|
133
|
+
pageCount: pageNames.length,
|
|
134
|
+
buildMode
|
|
135
|
+
});
|
|
113
136
|
}
|
|
114
137
|
}
|
|
115
138
|
async run() {
|
|
@@ -121,7 +144,12 @@ class AstroBuilder {
|
|
|
121
144
|
throw fixViteErrorMessage(createSafeError(_err), setupData.viteServer);
|
|
122
145
|
}
|
|
123
146
|
}
|
|
124
|
-
async printStats({
|
|
147
|
+
async printStats({
|
|
148
|
+
logging,
|
|
149
|
+
timeStart,
|
|
150
|
+
pageCount,
|
|
151
|
+
buildMode
|
|
152
|
+
}) {
|
|
125
153
|
const buildTime = performance.now() - timeStart;
|
|
126
154
|
const total = getTimeStat(timeStart, performance.now());
|
|
127
155
|
let messages = [];
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/core/build/util.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -32,6 +32,7 @@ const _args = ${adapter.args ? JSON.stringify(adapter.args) : "undefined"};
|
|
|
32
32
|
|
|
33
33
|
${adapter.exports ? `const _exports = adapter.createExports(_manifest, _args);
|
|
34
34
|
${adapter.exports.map((name) => `export const ${name} = _exports['${name}'];`).join("\n")}
|
|
35
|
+
${adapter.exports.includes("_default") ? `export default _default` : ""}
|
|
35
36
|
` : ""}
|
|
36
37
|
const _start = 'start';
|
|
37
38
|
if(_start in adapter) {
|
package/dist/core/config.js
CHANGED
|
@@ -196,10 +196,12 @@ function mergeCLIFlags(astroConfig, flags, cmd) {
|
|
|
196
196
|
astroConfig.experimental.integrations = flags.experimentalIntegrations;
|
|
197
197
|
if (typeof flags.drafts === "boolean")
|
|
198
198
|
astroConfig.markdown.drafts = flags.drafts;
|
|
199
|
-
if (typeof flags.port === "number")
|
|
199
|
+
if (typeof flags.port === "number") {
|
|
200
200
|
astroConfig.server.port = flags.port;
|
|
201
|
-
|
|
201
|
+
}
|
|
202
|
+
if (typeof flags.host === "string" || typeof flags.host === "boolean") {
|
|
202
203
|
astroConfig.server.host = flags.host;
|
|
204
|
+
}
|
|
203
205
|
return astroConfig;
|
|
204
206
|
}
|
|
205
207
|
async function resolveConfigURL(configOptions) {
|
package/dist/core/create-vite.js
CHANGED
|
@@ -88,7 +88,11 @@ async function getAstroPackages({ root }) {
|
|
|
88
88
|
const depPkgPath = fileURLToPath(depPkgUrl);
|
|
89
89
|
if (!fs.existsSync(depPkgPath))
|
|
90
90
|
return false;
|
|
91
|
-
const {
|
|
91
|
+
const {
|
|
92
|
+
dependencies = {},
|
|
93
|
+
peerDependencies = {},
|
|
94
|
+
keywords = []
|
|
95
|
+
} = JSON.parse(fs.readFileSync(depPkgPath, "utf-8"));
|
|
92
96
|
if (peerDependencies.astro || dependencies.astro)
|
|
93
97
|
return true;
|
|
94
98
|
if (keywords.includes("astro") || keywords.includes("astro-component"))
|
package/dist/core/dev/index.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { performance } from "perf_hooks";
|
|
2
2
|
import * as vite from "vite";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
runHookConfigDone,
|
|
5
|
+
runHookConfigSetup,
|
|
6
|
+
runHookServerDone,
|
|
7
|
+
runHookServerSetup,
|
|
8
|
+
runHookServerStart
|
|
9
|
+
} from "../../integrations/index.js";
|
|
4
10
|
import { createVite } from "../create-vite.js";
|
|
5
11
|
import { info, warn, warnIfUsingExperimentalSSR } from "../logger/core.js";
|
|
6
12
|
import { nodeLogOptions } from "../logger/node.js";
|
|
@@ -23,8 +29,14 @@ async function dev(config, options = { logging: nodeLogOptions }) {
|
|
|
23
29
|
await viteServer.listen(port);
|
|
24
30
|
const devServerAddressInfo = viteServer.httpServer.address();
|
|
25
31
|
const site = config.site ? new URL(config.base, config.site) : void 0;
|
|
26
|
-
info(options.logging, null, msg.devStart({
|
|
27
|
-
|
|
32
|
+
info(options.logging, null, msg.devStart({
|
|
33
|
+
startupTime: performance.now() - devStart,
|
|
34
|
+
config,
|
|
35
|
+
devServerAddressInfo,
|
|
36
|
+
site,
|
|
37
|
+
https: !!((_a = viteConfig.server) == null ? void 0 : _a.https)
|
|
38
|
+
}));
|
|
39
|
+
const currentVersion = "0.26.1";
|
|
28
40
|
if (currentVersion.includes("-")) {
|
|
29
41
|
warn(options.logging, null, msg.prerelease({ currentVersion }));
|
|
30
42
|
}
|
|
File without changes
|
|
File without changes
|
package/dist/core/errors.js
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/core/logger/core.js
CHANGED
|
File without changes
|
package/dist/core/logger/node.js
CHANGED
|
File without changes
|
package/dist/core/messages.js
CHANGED
|
@@ -1,9 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
bold,
|
|
3
|
+
dim,
|
|
4
|
+
red,
|
|
5
|
+
green,
|
|
6
|
+
underline,
|
|
7
|
+
yellow,
|
|
8
|
+
bgYellow,
|
|
9
|
+
cyan,
|
|
10
|
+
bgGreen,
|
|
11
|
+
black,
|
|
12
|
+
bgRed,
|
|
13
|
+
bgWhite
|
|
14
|
+
} from "kleur/colors";
|
|
2
15
|
import os from "os";
|
|
3
16
|
import { collectErrorMetadata, cleanErrorStack } from "./errors.js";
|
|
4
17
|
import { emoji, getLocalAddress, padMultilineString } from "./util.js";
|
|
5
18
|
const PREFIX_PADDING = 6;
|
|
6
|
-
function req({
|
|
19
|
+
function req({
|
|
20
|
+
url,
|
|
21
|
+
statusCode,
|
|
22
|
+
reqTime
|
|
23
|
+
}) {
|
|
7
24
|
let color = dim;
|
|
8
25
|
if (statusCode >= 500)
|
|
9
26
|
color = red;
|
|
@@ -28,7 +45,7 @@ function devStart({
|
|
|
28
45
|
https,
|
|
29
46
|
site
|
|
30
47
|
}) {
|
|
31
|
-
const version = "0.26.
|
|
48
|
+
const version = "0.26.1";
|
|
32
49
|
const rootPath = site ? site.pathname : "/";
|
|
33
50
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
34
51
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
@@ -40,7 +57,10 @@ function devStart({
|
|
|
40
57
|
if (networkLogging === "none") {
|
|
41
58
|
addresses = [`${localPrefix}${bold(cyan(toDisplayUrl(localAddress)))}`];
|
|
42
59
|
} else if (networkLogging === "host-to-expose") {
|
|
43
|
-
addresses = [
|
|
60
|
+
addresses = [
|
|
61
|
+
`${localPrefix}${bold(cyan(toDisplayUrl(localAddress)))}`,
|
|
62
|
+
`${networkPrefix}${dim("use --host to expose")}`
|
|
63
|
+
];
|
|
44
64
|
} else {
|
|
45
65
|
addresses = Object.values(os.networkInterfaces()).flatMap((networkInterface) => networkInterface ?? []).filter((networkInterface) => (networkInterface == null ? void 0 : networkInterface.address) && (networkInterface == null ? void 0 : networkInterface.family) === "IPv4").map(({ address }) => {
|
|
46
66
|
if (address.includes("127.0.0.1")) {
|
|
@@ -51,7 +71,12 @@ function devStart({
|
|
|
51
71
|
}
|
|
52
72
|
}).sort((msg) => msg.startsWith(localPrefix) ? -1 : 1);
|
|
53
73
|
}
|
|
54
|
-
const messages = [
|
|
74
|
+
const messages = [
|
|
75
|
+
`${emoji("\u{1F680} ", "")}${bgGreen(black(` astro `))} ${green(`v${version}`)} ${dim(`started in ${Math.round(startupTime)}ms`)}`,
|
|
76
|
+
"",
|
|
77
|
+
...addresses,
|
|
78
|
+
""
|
|
79
|
+
];
|
|
55
80
|
return messages.map((msg) => ` ${msg}`).join("\n");
|
|
56
81
|
}
|
|
57
82
|
function prerelease({ currentVersion }) {
|
|
@@ -145,7 +170,7 @@ function printHelp({
|
|
|
145
170
|
};
|
|
146
171
|
let message = [];
|
|
147
172
|
if (headline) {
|
|
148
|
-
message.push(linebreak(), ` ${bgGreen(black(` ${commandName} `))} ${green(`v${"0.26.
|
|
173
|
+
message.push(linebreak(), ` ${bgGreen(black(` ${commandName} `))} ${green(`v${"0.26.1"}`)} ${headline}`);
|
|
149
174
|
}
|
|
150
175
|
if (usage) {
|
|
151
176
|
message.push(linebreak(), ` ${green(commandName)} ${bold(usage)}`);
|
package/dist/core/path.js
CHANGED
|
File without changes
|
package/dist/core/polyfill.js
CHANGED
|
File without changes
|
|
@@ -57,7 +57,13 @@ async function preview(config, { logging }) {
|
|
|
57
57
|
httpServer = server.listen(port, host, async () => {
|
|
58
58
|
if (!showedListenMsg) {
|
|
59
59
|
const devServerAddressInfo = server.address();
|
|
60
|
-
info(logging, null, msg.devStart({
|
|
60
|
+
info(logging, null, msg.devStart({
|
|
61
|
+
startupTime: performance.now() - timerStart,
|
|
62
|
+
config,
|
|
63
|
+
devServerAddressInfo,
|
|
64
|
+
https: false,
|
|
65
|
+
site: baseURL
|
|
66
|
+
}));
|
|
61
67
|
}
|
|
62
68
|
showedListenMsg = true;
|
|
63
69
|
resolve();
|
|
File without changes
|
package/dist/core/render/core.js
CHANGED
|
@@ -49,7 +49,23 @@ async function getParamsAndProps(opts) {
|
|
|
49
49
|
return [params, pageProps];
|
|
50
50
|
}
|
|
51
51
|
async function render(opts) {
|
|
52
|
-
const {
|
|
52
|
+
const {
|
|
53
|
+
legacyBuild,
|
|
54
|
+
links,
|
|
55
|
+
logging,
|
|
56
|
+
origin,
|
|
57
|
+
markdownRender,
|
|
58
|
+
mod,
|
|
59
|
+
pathname,
|
|
60
|
+
scripts,
|
|
61
|
+
renderers,
|
|
62
|
+
request,
|
|
63
|
+
resolve,
|
|
64
|
+
route,
|
|
65
|
+
routeCache,
|
|
66
|
+
site,
|
|
67
|
+
ssr
|
|
68
|
+
} = opts;
|
|
53
69
|
const paramsAndPropsRes = await getParamsAndProps({
|
|
54
70
|
logging,
|
|
55
71
|
mod,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -36,13 +36,28 @@ async function loadRenderer(viteServer, renderer) {
|
|
|
36
36
|
async function loadRenderers(viteServer, astroConfig) {
|
|
37
37
|
return Promise.all(astroConfig._ctx.renderers.map((r) => loadRenderer(viteServer, r)));
|
|
38
38
|
}
|
|
39
|
-
async function preload({
|
|
39
|
+
async function preload({
|
|
40
|
+
astroConfig,
|
|
41
|
+
filePath,
|
|
42
|
+
viteServer
|
|
43
|
+
}) {
|
|
40
44
|
const renderers = await loadRenderers(viteServer, astroConfig);
|
|
41
45
|
const mod = await viteServer.ssrLoadModule(fileURLToPath(filePath));
|
|
42
46
|
return [renderers, mod];
|
|
43
47
|
}
|
|
44
48
|
async function render(renderers, mod, ssrOpts) {
|
|
45
|
-
const {
|
|
49
|
+
const {
|
|
50
|
+
astroConfig,
|
|
51
|
+
filePath,
|
|
52
|
+
logging,
|
|
53
|
+
mode,
|
|
54
|
+
origin,
|
|
55
|
+
pathname,
|
|
56
|
+
request,
|
|
57
|
+
route,
|
|
58
|
+
routeCache,
|
|
59
|
+
viteServer
|
|
60
|
+
} = ssrOpts;
|
|
46
61
|
const isLegacyBuild = false;
|
|
47
62
|
const scripts = createModuleScriptElementWithSrcSet(!isLegacyBuild && mod.hasOwnProperty("$$metadata") ? Array.from(mod.$$metadata.hoistedScriptPaths()) : []);
|
|
48
63
|
if (mod.hasOwnProperty("$$metadata") && mode === "development" && !isLegacyBuild) {
|
|
@@ -51,7 +66,10 @@ async function render(renderers, mod, ssrOpts) {
|
|
|
51
66
|
children: ""
|
|
52
67
|
});
|
|
53
68
|
scripts.add({
|
|
54
|
-
props: {
|
|
69
|
+
props: {
|
|
70
|
+
type: "module",
|
|
71
|
+
src: new URL("../../../runtime/client/hmr.js", import.meta.url).pathname
|
|
72
|
+
},
|
|
55
73
|
children: ""
|
|
56
74
|
});
|
|
57
75
|
}
|
|
@@ -55,7 +55,9 @@ Rename your file to \`[...page].astro\` or customize the param name via the \`pa
|
|
|
55
55
|
url: {
|
|
56
56
|
current: routeMatch.generate(__spreadValues({}, params)),
|
|
57
57
|
next: pageNum === lastPage ? void 0 : routeMatch.generate(__spreadProps(__spreadValues({}, params), { page: String(pageNum + 1) })),
|
|
58
|
-
prev: pageNum === 1 ? void 0 : routeMatch.generate(__spreadProps(__spreadValues({}, params), {
|
|
58
|
+
prev: pageNum === 1 ? void 0 : routeMatch.generate(__spreadProps(__spreadValues({}, params), {
|
|
59
|
+
page: !includesFirstPageNumber && pageNum - 1 === 1 ? void 0 : String(pageNum - 1)
|
|
60
|
+
}))
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
})
|
|
File without changes
|
|
File without changes
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { warn, debug } from "../logger/core.js";
|
|
2
2
|
import { generatePaginateFunction } from "./paginate.js";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
validateGetStaticPathsModule,
|
|
5
|
+
validateGetStaticPathsResult
|
|
6
|
+
} from "../routing/validation.js";
|
|
4
7
|
function stringifyParams(params) {
|
|
5
8
|
return JSON.stringify(params, Object.keys(params).sort());
|
|
6
9
|
}
|
|
7
|
-
async function callGetStaticPaths({
|
|
10
|
+
async function callGetStaticPaths({
|
|
11
|
+
isValidate,
|
|
12
|
+
logging,
|
|
13
|
+
mod,
|
|
14
|
+
route,
|
|
15
|
+
ssr
|
|
16
|
+
}) {
|
|
8
17
|
validateGetStaticPathsModule(mod, { ssr });
|
|
9
18
|
const resultInProgress = {
|
|
10
19
|
rss: []
|
package/dist/core/render/rss.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/core/render/util.js
CHANGED
|
@@ -15,7 +15,16 @@ function isValidURL(url) {
|
|
|
15
15
|
}
|
|
16
16
|
return false;
|
|
17
17
|
}
|
|
18
|
-
const STYLE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
18
|
+
const STYLE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
19
|
+
".css",
|
|
20
|
+
".pcss",
|
|
21
|
+
".postcss",
|
|
22
|
+
".scss",
|
|
23
|
+
".sass",
|
|
24
|
+
".styl",
|
|
25
|
+
".stylus",
|
|
26
|
+
".less"
|
|
27
|
+
]);
|
|
19
28
|
const cssRe = new RegExp(`\\.(${Array.from(STYLE_EXTENSIONS).map((s) => s.slice(1)).join("|")})($|\\?)`);
|
|
20
29
|
const isCSSRequest = (request) => cssRe.test(request);
|
|
21
30
|
export {
|
package/dist/core/request.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { warn } from "./logger/core.js";
|
|
2
|
-
function createRequest({
|
|
2
|
+
function createRequest({
|
|
3
|
+
url,
|
|
4
|
+
headers,
|
|
5
|
+
method = "GET",
|
|
6
|
+
body = void 0,
|
|
7
|
+
logging
|
|
8
|
+
}) {
|
|
3
9
|
let headersObj = headers instanceof Headers ? headers : new Headers(Object.entries(headers));
|
|
4
10
|
const request = new Request(url.toString(), {
|
|
5
11
|
method,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/core/util.js
CHANGED
|
File without changes
|