astro 1.2.7 → 1.2.8

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.
@@ -256,7 +256,7 @@ async function parseAstroConfig(configURL) {
256
256
  return result;
257
257
  }
258
258
  const toIdent = (name) => {
259
- const ident = name.trim().replace(/[-_\.]?astro(?:js)?[-_\.]?/g, "").replace(/\.js/, "").replace(/(?:[\.\-\_\/]+)([a-zA-Z])/g, (_, w) => w.toUpperCase()).replace(/^[^a-zA-Z$_]+/, "");
259
+ const ident = name.trim().replace(/[-_\.\/]?astro(?:js)?[-_\.]?/g, "").replace(/\.js/, "").replace(/(?:[\.\-\_\/]+)([a-zA-Z])/g, (_, w) => w.toUpperCase()).replace(/^[^a-zA-Z$_]+/, "");
260
260
  return `${ident[0].toLowerCase()}${ident.slice(1)}`;
261
261
  };
262
262
  function createPrettyError(err) {
@@ -85,6 +85,7 @@ async function ssrBuild(opts, internals, input) {
85
85
  logLevel: opts.viteConfig.logLevel ?? "error",
86
86
  mode: "production",
87
87
  build: {
88
+ target: "esnext",
88
89
  ...viteConfig.build,
89
90
  emptyOutDir: false,
90
91
  manifest: false,
@@ -101,7 +102,6 @@ async function ssrBuild(opts, internals, input) {
101
102
  }
102
103
  },
103
104
  ssr: true,
104
- target: "esnext",
105
105
  minify: false,
106
106
  polyfillModulePreload: false,
107
107
  reportCompressedSize: false
@@ -150,9 +150,9 @@ ${bgGreen(black(" building client "))}`);
150
150
  logLevel: "info",
151
151
  mode: "production",
152
152
  build: {
153
+ target: "esnext",
153
154
  ...viteConfig.build,
154
155
  emptyOutDir: false,
155
- minify: "esbuild",
156
156
  outDir: fileURLToPath(out),
157
157
  rollupOptions: {
158
158
  ...(_a = viteConfig.build) == null ? void 0 : _a.rollupOptions,
@@ -165,8 +165,7 @@ ${bgGreen(black(" building client "))}`);
165
165
  ...(_c = (_b = viteConfig.build) == null ? void 0 : _b.rollupOptions) == null ? void 0 : _c.output
166
166
  },
167
167
  preserveEntrySignatures: "exports-only"
168
- },
169
- target: "esnext"
168
+ }
170
169
  },
171
170
  plugins: [
172
171
  vitePluginInternals(input, internals),
@@ -158,15 +158,16 @@ function rollupPluginAstroBuildCSS(options) {
158
158
  name: "astro:rollup-plugin-build-css-minify",
159
159
  enforce: "post",
160
160
  async generateBundle(_outputOptions, bundle) {
161
- var _a, _b;
161
+ var _a, _b, _c;
162
162
  if (options.target === "server") {
163
163
  for (const [, output] of Object.entries(bundle)) {
164
164
  if (output.type === "asset") {
165
165
  if (((_a = output.name) == null ? void 0 : _a.endsWith(".css")) && typeof output.source === "string") {
166
166
  const cssTarget = (_b = settings.config.vite.build) == null ? void 0 : _b.cssTarget;
167
+ const minify = ((_c = settings.config.vite.build) == null ? void 0 : _c.minify) !== false;
167
168
  const { code: minifiedCSS } = await esbuild.transform(output.source, {
168
169
  loader: "css",
169
- minify: true,
170
+ minify,
170
171
  ...cssTarget ? { target: cssTarget } : {}
171
172
  });
172
173
  output.source = minifiedCSS;
@@ -48,7 +48,7 @@ async function dev(settings, options) {
48
48
  isRestart
49
49
  })
50
50
  );
51
- const currentVersion = "1.2.7";
51
+ const currentVersion = "1.2.8";
52
52
  if (currentVersion.includes("-")) {
53
53
  warn(options.logging, null, msg.prerelease({ currentVersion }));
54
54
  }
@@ -47,7 +47,7 @@ function devStart({
47
47
  site,
48
48
  isRestart = false
49
49
  }) {
50
- const version = "1.2.7";
50
+ const version = "1.2.8";
51
51
  const rootPath = site ? site.pathname : "/";
52
52
  const localPrefix = `${dim("\u2503")} Local `;
53
53
  const networkPrefix = `${dim("\u2503")} Network `;
@@ -226,7 +226,7 @@ function printHelp({
226
226
  message.push(
227
227
  linebreak(),
228
228
  ` ${bgGreen(black(` ${commandName} `))} ${green(
229
- `v${"1.2.7"}`
229
+ `v${"1.2.8"}`
230
230
  )} ${headline}`
231
231
  );
232
232
  }
@@ -88,7 +88,6 @@ async function render(opts) {
88
88
  site,
89
89
  scripts,
90
90
  ssr,
91
- streaming,
92
91
  status
93
92
  });
94
93
  if (typeof mod.components === "object") {
@@ -4,7 +4,6 @@ import { LogOptions } from '../logger/core.js';
4
4
  export interface CreateResultArgs {
5
5
  adapterName: string | undefined;
6
6
  ssr: boolean;
7
- streaming: boolean;
8
7
  logging: LogOptions;
9
8
  origin: string;
10
9
  markdown: MarkdownRenderingOptions;
@@ -112,12 +112,7 @@ function createResult(args) {
112
112
  const { markdown, params, pathname, props: pageProps, renderers, request, resolve } = args;
113
113
  const url = new URL(request.url);
114
114
  const headers = new Headers();
115
- if (args.streaming) {
116
- headers.set("Transfer-Encoding", "chunked");
117
- headers.set("Content-Type", "text/html");
118
- } else {
119
- headers.set("Content-Type", "text/html");
120
- }
115
+ headers.set("Content-Type", "text/html");
121
116
  const response = {
122
117
  status: args.status,
123
118
  statusText: "OK",
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.2.7";
8
+ const ASTRO_VERSION = "1.2.8";
9
9
  function isObject(value) {
10
10
  return typeof value === "object" && value != null;
11
11
  }
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "1.2.7";
1
+ const ASTRO_VERSION = "1.2.8";
2
2
  function createDeprecatedFetchContentFn() {
3
3
  return () => {
4
4
  throw new Error("Deprecated: Astro.fetchContent() has been replaced with Astro.glob().");
@@ -12,3 +12,4 @@ export declare class HTMLString extends String {
12
12
  * be returned through any public JS API.
13
13
  */
14
14
  export declare const markHTMLString: (value: any) => any;
15
+ export declare function unescapeHTML(str: any): any;
@@ -11,8 +11,17 @@ const markHTMLString = (value) => {
11
11
  }
12
12
  return value;
13
13
  };
14
+ function unescapeHTML(str) {
15
+ if (!!str && typeof str === "object" && typeof str.then === "function") {
16
+ return Promise.resolve(str).then((value) => {
17
+ return markHTMLString(value);
18
+ });
19
+ }
20
+ return markHTMLString(str);
21
+ }
14
22
  export {
15
23
  HTMLString,
16
24
  escapeHTML,
17
- markHTMLString
25
+ markHTMLString,
26
+ unescapeHTML
18
27
  };
@@ -1,6 +1,6 @@
1
1
  export { createAstro } from './astro-global.js';
2
2
  export { renderEndpoint } from './endpoint.js';
3
- export { escapeHTML, HTMLString, markHTMLString, markHTMLString as unescapeHTML, } from './escape.js';
3
+ export { escapeHTML, HTMLString, markHTMLString, unescapeHTML } from './escape.js';
4
4
  export type { Metadata } from './metadata';
5
5
  export { createMetadata } from './metadata.js';
6
6
  export { addAttribute, defineScriptVars, Fragment, maybeRenderHead, renderAstroComponent, renderComponent, Renderer as Renderer, renderHead, renderHTMLElement, renderPage, renderSlot, renderTemplate as render, renderTemplate, renderToString, stringifyChunk, voidElementNames, } from './render/index.js';
@@ -1,11 +1,6 @@
1
1
  import { createAstro } from "./astro-global.js";
2
2
  import { renderEndpoint } from "./endpoint.js";
3
- import {
4
- escapeHTML,
5
- HTMLString,
6
- markHTMLString,
7
- markHTMLString as markHTMLString2
8
- } from "./escape.js";
3
+ import { escapeHTML, HTMLString, markHTMLString, unescapeHTML } from "./escape.js";
9
4
  import { createMetadata } from "./metadata.js";
10
5
  import {
11
6
  addAttribute,
@@ -25,7 +20,7 @@ import {
25
20
  stringifyChunk,
26
21
  voidElementNames
27
22
  } from "./render/index.js";
28
- import { markHTMLString as markHTMLString3 } from "./escape.js";
23
+ import { markHTMLString as markHTMLString2 } from "./escape.js";
29
24
  import { Renderer as Renderer2 } from "./render/index.js";
30
25
  import { addAttribute as addAttribute2 } from "./render/index.js";
31
26
  function createComponent(cb) {
@@ -70,7 +65,7 @@ function spreadAttributes(values, _name, { class: scopedClassName } = {}) {
70
65
  for (const [key, value] of Object.entries(values)) {
71
66
  output += addAttribute2(value, key, true);
72
67
  }
73
- return markHTMLString3(output);
68
+ return markHTMLString2(output);
74
69
  }
75
70
  function defineStyleVars(defs) {
76
71
  let output = "";
@@ -82,7 +77,7 @@ function defineStyleVars(defs) {
82
77
  }
83
78
  }
84
79
  }
85
- return markHTMLString3(output);
80
+ return markHTMLString2(output);
86
81
  }
87
82
  export {
88
83
  Fragment,
@@ -111,6 +106,6 @@ export {
111
106
  renderToString,
112
107
  spreadAttributes,
113
108
  stringifyChunk,
114
- markHTMLString2 as unescapeHTML,
109
+ unescapeHTML,
115
110
  voidElementNames
116
111
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
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",
@@ -84,7 +84,7 @@
84
84
  "dependencies": {
85
85
  "@astrojs/compiler": "^0.24.0",
86
86
  "@astrojs/language-server": "^0.23.0",
87
- "@astrojs/markdown-remark": "^1.1.1",
87
+ "@astrojs/markdown-remark": "^1.1.2",
88
88
  "@astrojs/telemetry": "^1.0.0",
89
89
  "@astrojs/webapi": "^1.0.0",
90
90
  "@babel/core": "^7.18.2",