astro 2.3.0 → 2.3.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.
@@ -3,7 +3,7 @@ import { attachToResponse, getSetCookiesFromResponse } from "../cookies/index.js
3
3
  import { call as callEndpoint } from "../endpoint/index.js";
4
4
  import { consoleLogDestination } from "../logger/console.js";
5
5
  import { error } from "../logger/core.js";
6
- import { joinPaths, prependForwardSlash, removeTrailingForwardSlash } from "../path.js";
6
+ import { removeTrailingForwardSlash } from "../path.js";
7
7
  import {
8
8
  createEnvironment,
9
9
  createRenderContext,
@@ -11,6 +11,7 @@ import {
11
11
  } from "../render/index.js";
12
12
  import { RouteCache } from "../render/route-cache.js";
13
13
  import {
14
+ createAssetLink,
14
15
  createLinkStylesheetElementSet,
15
16
  createModuleScriptElement
16
17
  } from "../render/ssr-element.js";
@@ -54,7 +55,7 @@ class App {
54
55
  return bundlePath;
55
56
  }
56
57
  default: {
57
- return prependForwardSlash(joinPaths(manifest.base, bundlePath));
58
+ return createAssetLink(bundlePath, manifest.base, manifest.assetsPrefix);
58
59
  }
59
60
  }
60
61
  },
@@ -21,6 +21,7 @@ export interface SSRManifest {
21
21
  routes: RouteInfo[];
22
22
  site?: string;
23
23
  base?: string;
24
+ assetsPrefix?: string;
24
25
  markdown: MarkdownRenderingOptions;
25
26
  pageMap: Map<ComponentPath, ComponentInstance>;
26
27
  renderers: SSRLoadedRenderer[];
@@ -64,7 +64,7 @@ async function generatePages(opts, internals) {
64
64
  const ssr = opts.settings.config.output === "server";
65
65
  const serverEntry = opts.buildConfig.serverEntry;
66
66
  const outFolder = ssr ? opts.buildConfig.server : getOutDirWithinCwd(opts.settings.config.outDir);
67
- if (opts.settings.config.output === "server" && !hasPrerenderedPages(internals))
67
+ if (ssr && !hasPrerenderedPages(internals))
68
68
  return;
69
69
  const verb = ssr ? "prerendering" : "generating";
70
70
  info(opts.logging, null, `
@@ -72,7 +72,7 @@ ${bgGreen(black(` ${verb} static routes `))}`);
72
72
  const ssrEntryURL = new URL("./" + serverEntry + `?time=${Date.now()}`, outFolder);
73
73
  const ssrEntry = await import(ssrEntryURL.toString());
74
74
  const builtPaths = /* @__PURE__ */ new Set();
75
- if (opts.settings.config.output === "server") {
75
+ if (ssr) {
76
76
  for (const pageData of eachPrerenderedPageData(internals)) {
77
77
  await generatePage(opts, internals, pageData, ssrEntry, builtPaths);
78
78
  }
@@ -19,7 +19,7 @@ function vitePluginSSR(internals, adapter) {
19
19
  options(opts) {
20
20
  return addRollupInput(opts, [virtualModuleId]);
21
21
  },
22
- resolveId(id, parent) {
22
+ resolveId(id) {
23
23
  if (id === virtualModuleId) {
24
24
  return resolvedVirtualModuleId;
25
25
  }
@@ -171,6 +171,7 @@ function buildManifest(opts, internals, staticFiles) {
171
171
  routes,
172
172
  site: settings.config.site,
173
173
  base: settings.config.base,
174
+ assetsPrefix: settings.config.build.assetsPrefix,
174
175
  markdown: settings.config.markdown,
175
176
  pageMap: null,
176
177
  componentMetadata: Array.from(internals.componentMetadata),
@@ -52,10 +52,10 @@ export declare const AstroConfigSchema: z.ZodObject<{
52
52
  serverEntry: string;
53
53
  }, {
54
54
  assets?: string | undefined;
55
+ assetsPrefix?: string | undefined;
55
56
  server?: string | undefined;
56
57
  format?: "file" | "directory" | undefined;
57
58
  client?: string | undefined;
58
- assetsPrefix?: string | undefined;
59
59
  serverEntry?: string | undefined;
60
60
  }>>>;
61
61
  server: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodObject<{
@@ -227,10 +227,10 @@ export declare const AstroConfigSchema: z.ZodObject<{
227
227
  integrations?: unknown;
228
228
  build?: {
229
229
  assets?: string | undefined;
230
+ assetsPrefix?: string | undefined;
230
231
  server?: string | undefined;
231
232
  format?: "file" | "directory" | undefined;
232
233
  client?: string | undefined;
233
- assetsPrefix?: string | undefined;
234
234
  serverEntry?: string | undefined;
235
235
  } | undefined;
236
236
  image?: {
@@ -354,10 +354,10 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: URL)
354
354
  serverEntry: string;
355
355
  }, {
356
356
  assets?: string | undefined;
357
+ assetsPrefix?: string | undefined;
357
358
  server?: string | undefined;
358
359
  format?: "file" | "directory" | undefined;
359
360
  client?: string | undefined;
360
- assetsPrefix?: string | undefined;
361
361
  serverEntry?: string | undefined;
362
362
  }>>>;
363
363
  server: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodObject<{
@@ -470,10 +470,10 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: URL)
470
470
  integrations?: unknown;
471
471
  build?: {
472
472
  assets?: string | undefined;
473
+ assetsPrefix?: string | undefined;
473
474
  server?: string | undefined;
474
475
  format?: "file" | "directory" | undefined;
475
476
  client?: string | undefined;
476
- assetsPrefix?: string | undefined;
477
477
  serverEntry?: string | undefined;
478
478
  } | undefined;
479
479
  image?: {
@@ -569,10 +569,10 @@ export declare function createRelativeSchema(cmd: string, fileProtocolRoot: URL)
569
569
  integrations?: unknown;
570
570
  build?: {
571
571
  assets?: string | undefined;
572
+ assetsPrefix?: string | undefined;
572
573
  server?: string | undefined;
573
574
  format?: "file" | "directory" | undefined;
574
575
  client?: string | undefined;
575
- assetsPrefix?: string | undefined;
576
576
  serverEntry?: string | undefined;
577
577
  } | undefined;
578
578
  image?: {
@@ -4,7 +4,7 @@ import loadFallbackPlugin from "../../vite-plugin-load-fallback/index.js";
4
4
  async function createViteLoader(root, fs) {
5
5
  const viteServer = await vite.createServer({
6
6
  server: { middlewareMode: true, hmr: false },
7
- optimizeDeps: { entries: [] },
7
+ optimizeDeps: { disabled: true },
8
8
  clearScreen: false,
9
9
  appType: "custom",
10
10
  ssr: {
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "2.3.0";
1
+ const ASTRO_VERSION = "2.3.1";
2
2
  const SUPPORTED_MARKDOWN_FILE_EXTENSIONS = [
3
3
  ".markdown",
4
4
  ".mdown",
@@ -53,7 +53,7 @@ async function dev(settings, options) {
53
53
  isRestart: options.isRestart
54
54
  })
55
55
  );
56
- const currentVersion = "2.3.0";
56
+ const currentVersion = "2.3.1";
57
57
  if (currentVersion.includes("-")) {
58
58
  warn(options.logging, null, msg.prerelease({ currentVersion }));
59
59
  }
@@ -47,7 +47,7 @@ function serverStart({
47
47
  base,
48
48
  isRestart = false
49
49
  }) {
50
- const version = "2.3.0";
50
+ const version = "2.3.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.3.0"}`
236
+ `v${"2.3.1"}`
237
237
  )} ${headline}`
238
238
  );
239
239
  }
@@ -14,7 +14,7 @@ async function getParamsAndProps(opts) {
14
14
  let pageProps;
15
15
  if (route && !route.pathname) {
16
16
  if (route.params.length) {
17
- const paramsMatch = route.pattern.exec(pathname);
17
+ const paramsMatch = route.pattern.exec(decodeURIComponent(pathname));
18
18
  if (paramsMatch) {
19
19
  params = getParams(route.params)(paramsMatch);
20
20
  if (route.type === "endpoint" && mod.getStaticPaths) {
@@ -35,7 +35,7 @@ async function sync(settings, { logging, fs }) {
35
35
  await createVite(
36
36
  {
37
37
  server: { middlewareMode: true, hmr: false },
38
- optimizeDeps: { entries: [] },
38
+ optimizeDeps: { disabled: true },
39
39
  ssr: { external: [] },
40
40
  logLevel: "silent"
41
41
  },
package/dist/core/util.js CHANGED
@@ -121,7 +121,11 @@ function rootRelativePath(root, idOrUrl) {
121
121
  } else {
122
122
  id = idOrUrl;
123
123
  }
124
- return prependForwardSlash(id.slice(normalizePath(fileURLToPath(root)).length));
124
+ const normalizedRoot = normalizePath(fileURLToPath(root));
125
+ if (id.startsWith(normalizedRoot)) {
126
+ id = id.slice(normalizedRoot.length);
127
+ }
128
+ return prependForwardSlash(id);
125
129
  }
126
130
  function emoji(char, fallback) {
127
131
  return process.platform !== "win32" ? char : fallback;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
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",
@@ -142,7 +142,7 @@
142
142
  "typescript": "*",
143
143
  "unist-util-visit": "^4.1.0",
144
144
  "vfile": "^5.3.2",
145
- "vite": "^4.2.1",
145
+ "vite": "^4.3.1",
146
146
  "vitefu": "^0.2.4",
147
147
  "yargs-parser": "^21.0.1",
148
148
  "zod": "^3.20.6"