astro 1.4.6 → 1.4.7

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.
@@ -384,22 +384,13 @@ export interface AstroUserConfig {
384
384
  * @name base
385
385
  * @type {string}
386
386
  * @description
387
- * The base path you're deploying to. Astro will match this pathname during development so that your development experience matches your build environment as closely as possible. In the example below, `astro dev` will start your server at `/docs`.
387
+ * The base path to deploy to. Astro will build your pages and assets using this path as the root. Currently, this has no effect during development.
388
388
  *
389
389
  * ```js
390
390
  * {
391
391
  * base: '/docs'
392
392
  * }
393
393
  * ```
394
- *
395
- * When using this option, you should mind that all of your imports will be affected. In this example, all of the imports including static resources and codes should add a prefix `/docs/`.
396
- *
397
- * For example, if you want to use a image in your Astro component, you need to change it from '/someimg.png' into '/docs/someimg.png'.
398
- *
399
- * ```astro
400
- * <!-- <img src="/someimg.png"> is not correct. -->
401
- * <img src="/docs/someimg.png">
402
- * ```
403
394
  */
404
395
  base?: string;
405
396
  /**
@@ -2,7 +2,6 @@ import crypto from "crypto";
2
2
  import esbuild from "esbuild";
3
3
  import npath from "path";
4
4
  import { isCSSRequest } from "../render/util.js";
5
- import { relativeToSrcDir } from "../util.js";
6
5
  import { getTopLevelPages, moduleIsTopLevelPage, walkParentInfos } from "./graph.js";
7
6
  import {
8
7
  eachPageData,
@@ -11,32 +10,22 @@ import {
11
10
  getPageDatasByHoistedScriptId,
12
11
  isHoistedScript
13
12
  } from "./internal.js";
14
- const MAX_NAME_LENGTH = 70;
15
13
  function rollupPluginAstroBuildCSS(options) {
16
14
  const { internals, buildOptions } = options;
17
15
  const { settings } = buildOptions;
18
16
  let resolvedConfig;
19
- function nameifyPage(id) {
20
- let rel = relativeToSrcDir(settings.config, id);
21
- if (rel.startsWith("pages/")) {
22
- rel = rel.slice(6);
23
- }
24
- const ext = npath.extname(rel);
25
- const noext = rel.slice(0, rel.length - ext.length);
26
- const named = noext.replace(/\//g, "-");
27
- return named;
28
- }
29
17
  function createNameForParentPages(id, ctx) {
18
+ var _a;
30
19
  const parents = Array.from(getTopLevelPages(id, ctx));
31
- const proposedName = parents.map(([page]) => nameifyPage(page.id)).sort().join("-");
32
- if (proposedName.length <= MAX_NAME_LENGTH) {
33
- return proposedName;
34
- }
20
+ const firstParentId = (_a = parents[0]) == null ? void 0 : _a[0].id;
21
+ const firstParentName = firstParentId ? npath.parse(firstParentId).name : "index";
35
22
  const hash = crypto.createHash("sha256");
36
23
  for (const [page] of parents) {
37
24
  hash.update(page.id, "utf-8");
38
25
  }
39
- return hash.digest("hex").slice(0, 8);
26
+ const h = hash.digest("hex").slice(0, 8);
27
+ const proposedName = firstParentName + "." + h;
28
+ return proposedName;
40
29
  }
41
30
  function* getParentClientOnlys(id, ctx) {
42
31
  for (const [info] of walkParentInfos(id, ctx)) {
@@ -49,7 +49,7 @@ async function dev(settings, options) {
49
49
  isRestart
50
50
  })
51
51
  );
52
- const currentVersion = "1.4.6";
52
+ const currentVersion = "1.4.7";
53
53
  if (currentVersion.includes("-")) {
54
54
  warn(options.logging, null, msg.prerelease({ currentVersion }));
55
55
  }
@@ -47,7 +47,7 @@ function serverStart({
47
47
  site,
48
48
  isRestart = false
49
49
  }) {
50
- const version = "1.4.6";
50
+ const version = "1.4.7";
51
51
  const rootPath = site ? site.pathname : "/";
52
52
  const localPrefix = `${dim("\u2503")} Local `;
53
53
  const networkPrefix = `${dim("\u2503")} Network `;
@@ -250,7 +250,7 @@ function printHelp({
250
250
  message.push(
251
251
  linebreak(),
252
252
  ` ${bgGreen(black(` ${commandName} `))} ${green(
253
- `v${"1.4.6"}`
253
+ `v${"1.4.7"}`
254
254
  )} ${headline}`
255
255
  );
256
256
  }
package/dist/core/util.js CHANGED
@@ -5,7 +5,7 @@ import resolve from "resolve";
5
5
  import slash from "slash";
6
6
  import { fileURLToPath, pathToFileURL } from "url";
7
7
  import { prependForwardSlash, removeTrailingForwardSlash } from "./path.js";
8
- const ASTRO_VERSION = "1.4.6";
8
+ const ASTRO_VERSION = "1.4.7";
9
9
  function isObject(value) {
10
10
  return typeof value === "object" && value != null;
11
11
  }
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "1.4.6";
1
+ const ASTRO_VERSION = "1.4.7";
2
2
  function createDeprecatedFetchContentFn() {
3
3
  return () => {
4
4
  throw new Error("Deprecated: Astro.fetchContent() has been replaced with Astro.glob().");
@@ -84,7 +84,7 @@ async function generateHydrateScript(scriptOptions, metadata) {
84
84
  };
85
85
  if (attrs) {
86
86
  for (const [key, value] of Object.entries(attrs)) {
87
- island.props[key] = value;
87
+ island.props[key] = escapeHTML(value);
88
88
  }
89
89
  }
90
90
  island.props["component-url"] = await result.resolve(decodeURI(componentUrl));
@@ -14,6 +14,7 @@ async function iterableToHTMLBytes(result, iterable, onDocTypeInjection) {
14
14
  for await (const chunk of iterable) {
15
15
  if (isHTMLString(chunk)) {
16
16
  if (i === 0) {
17
+ i++;
17
18
  if (!/<!doctype html/i.test(String(chunk))) {
18
19
  parts.append("<!DOCTYPE html>\n", result);
19
20
  if (onDocTypeInjection) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "1.4.6",
3
+ "version": "1.4.7",
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",