astro 4.1.1 → 4.1.3

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.
Files changed (85) hide show
  1. package/components/ViewTransitions.astro +6 -1
  2. package/dist/@types/astro.d.ts +26 -25
  3. package/dist/assets/internal.js +3 -2
  4. package/dist/assets/services/noop.js +1 -4
  5. package/dist/assets/types.d.ts +1 -1
  6. package/dist/assets/utils/emitAsset.js +1 -1
  7. package/dist/assets/utils/proxy.d.ts +2 -1
  8. package/dist/assets/utils/proxy.js +5 -1
  9. package/dist/assets/vite-plugin-assets.js +21 -14
  10. package/dist/content/runtime-assets.d.ts +1 -1
  11. package/dist/content/runtime-assets.js +1 -1
  12. package/dist/content/vite-plugin-content-imports.js +5 -5
  13. package/dist/core/config/vite-load.js +1 -1
  14. package/dist/core/constants.js +1 -1
  15. package/dist/core/cookies/cookies.d.ts +5 -0
  16. package/dist/core/cookies/cookies.js +17 -0
  17. package/dist/core/cookies/response.d.ts +1 -1
  18. package/dist/core/cookies/response.js +2 -1
  19. package/dist/core/create-vite.js +9 -4
  20. package/dist/core/dev/dev.js +1 -1
  21. package/dist/core/errors/dev/utils.js +1 -1
  22. package/dist/core/errors/errors-data.d.ts +43 -25
  23. package/dist/core/errors/errors-data.js +32 -33
  24. package/dist/core/messages.js +2 -2
  25. package/dist/core/redirects/helpers.js +2 -2
  26. package/dist/core/routing/manifest/create.js +22 -1
  27. package/dist/core/sync/index.js +1 -1
  28. package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/astro.js +3 -3
  29. package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/audit/index.js +4 -4
  30. package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/settings.js +7 -7
  31. package/dist/runtime/client/dev-toolbar/apps/utils/highlight.d.ts +8 -0
  32. package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/utils/window.d.ts +1 -1
  33. package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/xray.js +5 -5
  34. package/dist/runtime/client/{dev-overlay → dev-toolbar}/entrypoint.js +64 -68
  35. package/dist/runtime/client/{dev-overlay → dev-toolbar}/settings.d.ts +2 -2
  36. package/dist/runtime/client/{dev-overlay → dev-toolbar}/settings.js +10 -5
  37. package/dist/runtime/client/dev-toolbar/toolbar.d.ts +45 -0
  38. package/dist/runtime/client/{dev-overlay/overlay.js → dev-toolbar/toolbar.js} +99 -103
  39. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/badge.d.ts +1 -1
  40. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/badge.js +2 -2
  41. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/button.d.ts +1 -1
  42. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/button.js +3 -2
  43. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/card.d.ts +1 -1
  44. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/card.js +2 -2
  45. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/highlight.d.ts +1 -1
  46. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/highlight.js +2 -2
  47. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/icon.d.ts +1 -1
  48. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/icon.js +2 -2
  49. package/dist/runtime/client/dev-toolbar/ui-library/index.d.ts +8 -0
  50. package/dist/runtime/client/dev-toolbar/ui-library/index.js +18 -0
  51. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/toggle.d.ts +1 -1
  52. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/toggle.js +2 -2
  53. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/tooltip.d.ts +3 -3
  54. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/tooltip.js +2 -2
  55. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/window.d.ts +1 -1
  56. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/window.js +3 -3
  57. package/dist/transitions/router.js +4 -1
  58. package/dist/vite-plugin-astro/index.js +12 -2
  59. package/dist/vite-plugin-astro-server/route.js +7 -4
  60. package/dist/vite-plugin-config-alias/index.js +3 -0
  61. package/dist/{vite-plugin-dev-overlay/vite-plugin-dev-overlay.d.ts → vite-plugin-dev-toolbar/vite-plugin-dev-toolbar.d.ts} +1 -1
  62. package/dist/{vite-plugin-dev-overlay/vite-plugin-dev-overlay.js → vite-plugin-dev-toolbar/vite-plugin-dev-toolbar.js} +5 -5
  63. package/dist/vite-plugin-env/index.d.ts +1 -1
  64. package/dist/vite-plugin-env/index.js +81 -43
  65. package/dist/vite-plugin-markdown/index.js +3 -3
  66. package/dist/vite-plugin-utils/index.d.ts +0 -6
  67. package/dist/vite-plugin-utils/index.js +0 -4
  68. package/package.json +2 -2
  69. package/dist/runtime/client/dev-overlay/overlay.d.ts +0 -45
  70. package/dist/runtime/client/dev-overlay/plugins/utils/highlight.d.ts +0 -8
  71. package/dist/runtime/client/dev-overlay/ui-library/index.d.ts +0 -8
  72. package/dist/runtime/client/dev-overlay/ui-library/index.js +0 -18
  73. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/astro.d.ts +0 -0
  74. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/audit/a11y.d.ts +0 -0
  75. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/audit/a11y.js +0 -0
  76. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/audit/index.d.ts +0 -0
  77. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/settings.d.ts +0 -0
  78. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/utils/highlight.js +0 -0
  79. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/utils/icons.d.ts +0 -0
  80. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/utils/icons.js +0 -0
  81. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/utils/window.js +0 -0
  82. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/xray.d.ts +0 -0
  83. /package/dist/runtime/client/{dev-overlay → dev-toolbar}/entrypoint.d.ts +0 -0
  84. /package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/icons.d.ts +0 -0
  85. /package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/icons.js +0 -0
@@ -1,4 +1,4 @@
1
- class DevOverlayWindow extends HTMLElement {
1
+ class DevToolbarWindow extends HTMLElement {
2
2
  shadowRoot;
3
3
  constructor() {
4
4
  super();
@@ -32,7 +32,7 @@ class DevOverlayWindow extends HTMLElement {
32
32
  background: white;
33
33
  }
34
34
  }
35
-
35
+
36
36
  @media (max-width: 640px) {
37
37
  :host {
38
38
  border-radius: 0;
@@ -79,5 +79,5 @@ class DevOverlayWindow extends HTMLElement {
79
79
  }
80
80
  }
81
81
  export {
82
- DevOverlayWindow
82
+ DevToolbarWindow
83
83
  };
@@ -98,12 +98,15 @@ function runScripts() {
98
98
  for (const script of Array.from(document.scripts)) {
99
99
  if (script.dataset.astroExec === "")
100
100
  continue;
101
+ const type = script.getAttribute("type");
102
+ if (type && type !== "module" && type !== "text/javascript")
103
+ continue;
101
104
  const newScript = document.createElement("script");
102
105
  newScript.innerHTML = script.innerHTML;
103
106
  for (const attr of script.attributes) {
104
107
  if (attr.name === "src") {
105
108
  const p = new Promise((r) => {
106
- newScript.onload = r;
109
+ newScript.onload = newScript.onerror = r;
107
110
  });
108
111
  wait = wait.then(() => p);
109
112
  }
@@ -12,6 +12,7 @@ import { getAstroMetadata } from "./metadata.js";
12
12
  function astro({ settings, logger }) {
13
13
  const { config } = settings;
14
14
  let resolvedConfig;
15
+ let server;
15
16
  const srcRootWeb = config.srcDir.pathname.slice(config.root.pathname.length - 1);
16
17
  const isBrowserPath = (path) => path.startsWith(srcRootWeb) && srcRootWeb !== "/";
17
18
  const prePlugin = {
@@ -21,6 +22,9 @@ function astro({ settings, logger }) {
21
22
  configResolved(_resolvedConfig) {
22
23
  resolvedConfig = _resolvedConfig;
23
24
  },
25
+ configureServer(_server) {
26
+ server = _server;
27
+ },
24
28
  async load(id, opts) {
25
29
  const parsedId = parseAstroRequest(id);
26
30
  const query = parsedId.query;
@@ -28,9 +32,15 @@ function astro({ settings, logger }) {
28
32
  return null;
29
33
  }
30
34
  const filename = normalizePath(normalizeFilename(parsedId.filename, config.root));
31
- const compileResult = getCachedCompileResult(config, filename);
35
+ let compileResult = getCachedCompileResult(config, filename);
32
36
  if (!compileResult) {
33
- return null;
37
+ if (server) {
38
+ await server.transformRequest("/@fs" + filename);
39
+ compileResult = getCachedCompileResult(config, filename);
40
+ }
41
+ if (!compileResult) {
42
+ throw new Error("No cached compile result found for " + id);
43
+ }
34
44
  }
35
45
  switch (query.type) {
36
46
  case "style": {
@@ -12,6 +12,7 @@ import {
12
12
  import { createRequest } from "../core/request.js";
13
13
  import { matchAllRoutes } from "../core/routing/index.js";
14
14
  import { isPage, resolveIdToUrl } from "../core/util.js";
15
+ import { normalizeTheLocale } from "../i18n/index.js";
15
16
  import { createI18nMiddleware, i18nPipelineHook } from "../i18n/middleware.js";
16
17
  import { getSortedPreloadedMatches } from "../prerender/routing.js";
17
18
  import { isServerLikeOutput } from "../prerender/utils.js";
@@ -21,7 +22,6 @@ import { preload } from "./index.js";
21
22
  import { getComponentMetadata } from "./metadata.js";
22
23
  import { handle404Response, writeSSRResult, writeWebResponse } from "./response.js";
23
24
  import { getScriptsForURL } from "./scripts.js";
24
- import { normalizeTheLocale } from "../i18n/index.js";
25
25
  const clientLocalsSymbol = Symbol.for("astro.locals");
26
26
  function isLoggedRequest(url) {
27
27
  return url !== "/favicon.ico";
@@ -284,7 +284,10 @@ async function handleRoute({
284
284
  return;
285
285
  }
286
286
  if (status && response.status !== status && (status === 404 || status === 500)) {
287
- response = new Response(response.body, { ...response, status });
287
+ response = new Response(response.body, {
288
+ status,
289
+ headers: response.headers
290
+ });
288
291
  }
289
292
  await writeSSRResult(request, response, incomingResponse);
290
293
  }
@@ -302,7 +305,7 @@ async function getScriptsAndStyles({ pipeline, filePath }) {
302
305
  scripts.add({
303
306
  props: {
304
307
  type: "module",
305
- src: await resolveIdToUrl(moduleLoader, "astro/runtime/client/dev-overlay/entrypoint.js")
308
+ src: await resolveIdToUrl(moduleLoader, "astro/runtime/client/dev-toolbar/entrypoint.js")
306
309
  },
307
310
  children: ""
308
311
  });
@@ -313,7 +316,7 @@ async function getScriptsAndStyles({ pipeline, filePath }) {
313
316
  };
314
317
  scripts.add({
315
318
  props: {},
316
- children: `window.__astro_dev_overlay__ = ${JSON.stringify(additionalMetadata)}`
319
+ children: `window.__astro_dev_toolbar__ = ${JSON.stringify(additionalMetadata)}`
317
320
  });
318
321
  }
319
322
  }
@@ -48,6 +48,9 @@ function configAliasVitePlugin({
48
48
  for (const alias of configAlias) {
49
49
  if (alias.find.test(id)) {
50
50
  const updatedId = id.replace(alias.find, alias.replacement);
51
+ if (updatedId.includes("*")) {
52
+ return updatedId;
53
+ }
51
54
  const resolved = await this.resolve(updatedId, importer, { skipSelf: true, ...options });
52
55
  if (resolved)
53
56
  return resolved;
@@ -1,3 +1,3 @@
1
1
  import type * as vite from 'vite';
2
2
  import type { AstroPluginOptions } from '../@types/astro.js';
3
- export default function astroDevOverlay({ settings }: AstroPluginOptions): vite.Plugin;
3
+ export default function astroDevToolbar({ settings }: AstroPluginOptions): vite.Plugin;
@@ -1,8 +1,8 @@
1
- const VIRTUAL_MODULE_ID = "astro:dev-overlay";
1
+ const VIRTUAL_MODULE_ID = "astro:dev-toolbar";
2
2
  const resolvedVirtualModuleId = "\0" + VIRTUAL_MODULE_ID;
3
- function astroDevOverlay({ settings }) {
3
+ function astroDevToolbar({ settings }) {
4
4
  return {
5
- name: "astro:dev-overlay",
5
+ name: "astro:dev-toolbar",
6
6
  config() {
7
7
  return {
8
8
  optimizeDeps: {
@@ -19,7 +19,7 @@ function astroDevOverlay({ settings }) {
19
19
  async load(id) {
20
20
  if (id === resolvedVirtualModuleId) {
21
21
  return `
22
- export const loadDevOverlayPlugins = async () => {
22
+ export const loadDevToolbarApps = async () => {
23
23
  return [${settings.devToolbarApps.map((plugin) => `(await import(${JSON.stringify(plugin)})).default`).join(",")}];
24
24
  };
25
25
  `;
@@ -28,5 +28,5 @@ function astroDevOverlay({ settings }) {
28
28
  };
29
29
  }
30
30
  export {
31
- astroDevOverlay as default
31
+ astroDevToolbar as default
32
32
  };
@@ -3,5 +3,5 @@ import type { AstroSettings } from '../@types/astro.js';
3
3
  interface EnvPluginOptions {
4
4
  settings: AstroSettings;
5
5
  }
6
- export default function envVitePlugin({ settings }: EnvPluginOptions): vite.PluginOption;
6
+ export default function envVitePlugin({ settings }: EnvPluginOptions): vite.Plugin;
7
7
  export {};
@@ -1,6 +1,9 @@
1
- import MagicString from "magic-string";
2
1
  import { fileURLToPath } from "node:url";
3
2
  import { loadEnv } from "vite";
3
+ import { transform } from "esbuild";
4
+ import MagicString from "magic-string";
5
+ const importMetaEnvOnlyRe = /\bimport\.meta\.env\b(?!\.)/;
6
+ const isValidIdentifierRe = /^[_$a-zA-Z][_$a-zA-Z0-9]*$/;
4
7
  function getPrivateEnv(viteConfig, astroConfig) {
5
8
  let envPrefixes = ["PUBLIC_"];
6
9
  if (viteConfig.envPrefix) {
@@ -13,7 +16,7 @@ function getPrivateEnv(viteConfig, astroConfig) {
13
16
  );
14
17
  const privateEnv = {};
15
18
  for (const key in fullEnv) {
16
- if (envPrefixes.every((prefix) => !key.startsWith(prefix))) {
19
+ if (isValidIdentifierRe.test(key) && envPrefixes.every((prefix) => !key.startsWith(prefix))) {
17
20
  if (typeof process.env[key] !== "undefined") {
18
21
  let value = process.env[key];
19
22
  if (typeof value !== "string") {
@@ -29,10 +32,6 @@ function getPrivateEnv(viteConfig, astroConfig) {
29
32
  }
30
33
  }
31
34
  }
32
- privateEnv.SITE = astroConfig.site ? JSON.stringify(astroConfig.site) : "undefined";
33
- privateEnv.SSR = JSON.stringify(true);
34
- privateEnv.BASE_URL = astroConfig.base ? JSON.stringify(astroConfig.base) : "undefined";
35
- privateEnv.ASSETS_PREFIX = astroConfig.build.assetsPrefix ? JSON.stringify(astroConfig.build.assetsPrefix) : "undefined";
36
35
  return privateEnv;
37
36
  }
38
37
  function getReferencedPrivateKeys(source, privateEnv) {
@@ -44,63 +43,102 @@ function getReferencedPrivateKeys(source, privateEnv) {
44
43
  }
45
44
  return references;
46
45
  }
46
+ async function replaceDefine(code, id, define, config) {
47
+ const replacementMarkers = {};
48
+ const env = define["import.meta.env"];
49
+ if (env) {
50
+ const marker = `__astro_import_meta_env${"_".repeat(
51
+ env.length - 23
52
+ /* length of preceding string */
53
+ )}`;
54
+ replacementMarkers[marker] = env;
55
+ define = { ...define, "import.meta.env": marker };
56
+ }
57
+ const esbuildOptions = config.esbuild || {};
58
+ const result = await transform(code, {
59
+ loader: "js",
60
+ charset: esbuildOptions.charset ?? "utf8",
61
+ platform: "neutral",
62
+ define,
63
+ sourcefile: id,
64
+ sourcemap: config.command === "build" ? !!config.build.sourcemap : true
65
+ });
66
+ for (const marker in replacementMarkers) {
67
+ result.code = result.code.replaceAll(marker, replacementMarkers[marker]);
68
+ }
69
+ return {
70
+ code: result.code,
71
+ map: result.map || null
72
+ };
73
+ }
47
74
  function envVitePlugin({ settings }) {
48
75
  let privateEnv;
76
+ let defaultDefines;
77
+ let isDev;
78
+ let devImportMetaEnvPrepend;
49
79
  let viteConfig;
50
80
  const { config: astroConfig } = settings;
51
81
  return {
52
82
  name: "astro:vite-plugin-env",
53
- enforce: "pre",
54
- config() {
55
- return {
56
- define: {
57
- "import.meta.env.BASE_URL": astroConfig.base ? JSON.stringify(astroConfig.base) : "undefined",
58
- "import.meta.env.ASSETS_PREFIX": astroConfig.build.assetsPrefix ? JSON.stringify(astroConfig.build.assetsPrefix) : "undefined"
59
- }
60
- };
83
+ config(_, { command }) {
84
+ isDev = command !== "build";
61
85
  },
62
86
  configResolved(resolvedConfig) {
63
87
  viteConfig = resolvedConfig;
88
+ const viteDefinePluginIndex = resolvedConfig.plugins.findIndex(
89
+ (p) => p.name === "vite:define"
90
+ );
91
+ if (viteDefinePluginIndex !== -1) {
92
+ const myPluginIndex = resolvedConfig.plugins.findIndex(
93
+ (p) => p.name === "astro:vite-plugin-env"
94
+ );
95
+ if (myPluginIndex !== -1) {
96
+ const myPlugin = resolvedConfig.plugins[myPluginIndex];
97
+ resolvedConfig.plugins.splice(viteDefinePluginIndex, 0, myPlugin);
98
+ resolvedConfig.plugins.splice(myPluginIndex, 1);
99
+ }
100
+ }
64
101
  },
65
- async transform(source, id, options) {
102
+ transform(source, id, options) {
66
103
  if (!options?.ssr || !source.includes("import.meta.env")) {
67
104
  return;
68
105
  }
69
- let s;
70
- const pattern = new RegExp(
71
- // Do not allow preceding '.', but do allow preceding '...' for spread operations
72
- `(?<!(?<!\\.\\.)\\.)\\b(import\\.meta\\.env\\.(.+?)|import\\.meta\\.env)\\b(?!\\s*?=[^=])`,
73
- "g"
74
- );
75
- let references;
76
- let match;
77
- while (match = pattern.exec(source)) {
78
- let replacement;
79
- if (match[0] === "import.meta.env") {
80
- privateEnv ??= getPrivateEnv(viteConfig, astroConfig);
81
- references ??= getReferencedPrivateKeys(source, privateEnv);
82
- replacement = `(Object.assign(import.meta.env,{`;
83
- for (const key of references.values()) {
84
- replacement += `${key}:${privateEnv[key]},`;
106
+ privateEnv ??= getPrivateEnv(viteConfig, astroConfig);
107
+ if (isDev) {
108
+ const s = new MagicString(source);
109
+ if (!devImportMetaEnvPrepend) {
110
+ devImportMetaEnvPrepend = `Object.assign(import.meta.env,{`;
111
+ for (const key in privateEnv) {
112
+ devImportMetaEnvPrepend += `${key}:${privateEnv[key]},`;
85
113
  }
86
- replacement += "}))";
87
- } else if (match[2]) {
88
- privateEnv ??= getPrivateEnv(viteConfig, astroConfig);
89
- replacement = privateEnv[match[2]];
90
- }
91
- if (replacement) {
92
- const start = match.index;
93
- const end = start + match[0].length;
94
- s ??= new MagicString(source);
95
- s.overwrite(start, end, replacement);
114
+ devImportMetaEnvPrepend += "});";
96
115
  }
97
- }
98
- if (s) {
116
+ s.prepend(devImportMetaEnvPrepend);
99
117
  return {
100
118
  code: s.toString(),
101
119
  map: s.generateMap({ hires: "boundary" })
102
120
  };
103
121
  }
122
+ if (!defaultDefines) {
123
+ defaultDefines = {};
124
+ for (const key in privateEnv) {
125
+ defaultDefines[`import.meta.env.${key}`] = privateEnv[key];
126
+ }
127
+ }
128
+ let defines = defaultDefines;
129
+ if (importMetaEnvOnlyRe.test(source)) {
130
+ const references = getReferencedPrivateKeys(source, privateEnv);
131
+ let replacement = `(Object.assign(import.meta.env,{`;
132
+ for (const key of references.values()) {
133
+ replacement += `${key}:${privateEnv[key]},`;
134
+ }
135
+ replacement += "}))";
136
+ defines = {
137
+ ...defaultDefines,
138
+ "import.meta.env": replacement
139
+ };
140
+ }
141
+ return replaceDefine(source, id, defines, viteConfig);
104
142
  }
105
143
  };
106
144
  }
@@ -10,7 +10,7 @@ import { normalizePath } from "vite";
10
10
  import { AstroError, AstroErrorData, MarkdownError } from "../core/errors/index.js";
11
11
  import { isMarkdownFile } from "../core/util.js";
12
12
  import { shorthash } from "../runtime/server/shorthash.js";
13
- import { escapeViteEnvReferences, getFileInfo } from "../vite-plugin-utils/index.js";
13
+ import { getFileInfo } from "../vite-plugin-utils/index.js";
14
14
  import { getMarkdownCodeForImages } from "./images.js";
15
15
  function safeMatter(source, id) {
16
16
  try {
@@ -86,7 +86,7 @@ function markdown({ settings, logger }) {
86
86
  `[${id}] Astro now supports MDX! Support for components in ".md" (or alternative extensions like ".markdown") files using the "setup" frontmatter is no longer enabled by default. Migrate this file to MDX.`
87
87
  );
88
88
  }
89
- const code = escapeViteEnvReferences(`
89
+ const code = `
90
90
  import { unescapeHTML, spreadAttributes, createComponent, render, renderComponent, maybeRenderHead } from ${JSON.stringify(
91
91
  astroServerRuntimeModulePath
92
92
  )};
@@ -128,7 +128,7 @@ function markdown({ settings, logger }) {
128
128
  })}\`;` : `render\`\${maybeRenderHead(result)}\${unescapeHTML(html)}\`;`}
129
129
  });
130
130
  export default Content;
131
- `);
131
+ `;
132
132
  return {
133
133
  code,
134
134
  meta: {
@@ -1,10 +1,4 @@
1
1
  import type { AstroConfig } from '../@types/astro.js';
2
- /**
3
- * Converts the first dot in `import.meta.env` to its Unicode escape sequence,
4
- * which prevents Vite from replacing strings like `import.meta.env.SITE`
5
- * in our JS representation of modules like Markdown
6
- */
7
- export declare function escapeViteEnvReferences(code: string): string;
8
2
  export declare function getFileInfo(id: string, config: AstroConfig): {
9
3
  fileId: string;
10
4
  fileUrl: string | undefined;
@@ -6,9 +6,6 @@ import {
6
6
  removeLeadingForwardSlashWindows
7
7
  } from "../core/path.js";
8
8
  import { viteID } from "../core/util.js";
9
- function escapeViteEnvReferences(code) {
10
- return code.replace(/import\.meta\.env/g, "import\\u002Emeta.env").replace(/process\.env/g, "process\\u002Eenv");
11
- }
12
9
  function getFileInfo(id, config) {
13
10
  const sitePathname = appendForwardSlash(
14
11
  config.site ? new URL(config.base, config.site).pathname : config.base
@@ -38,7 +35,6 @@ function cleanUrl(url) {
38
35
  }
39
36
  export {
40
37
  cleanUrl,
41
- escapeViteEnvReferences,
42
38
  getFileInfo,
43
39
  normalizeFilename
44
40
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "4.1.1",
3
+ "version": "4.1.3",
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",
@@ -166,7 +166,7 @@
166
166
  "@astrojs/telemetry": "3.0.4"
167
167
  },
168
168
  "optionalDependencies": {
169
- "sharp": "^0.33.1"
169
+ "sharp": "^0.32.6"
170
170
  },
171
171
  "devDependencies": {
172
172
  "@astrojs/check": "^0.3.1",
@@ -1,45 +0,0 @@
1
- import type { DevOverlayPlugin as DevOverlayPluginDefinition } from '../../../@types/astro.js';
2
- import { type Icon } from './ui-library/icons.js';
3
- export type DevOverlayPlugin = DevOverlayPluginDefinition & {
4
- builtIn: boolean;
5
- active: boolean;
6
- status: 'ready' | 'loading' | 'error';
7
- notification: {
8
- state: boolean;
9
- };
10
- eventTarget: EventTarget;
11
- };
12
- export declare class AstroDevOverlay extends HTMLElement {
13
- shadowRoot: ShadowRoot;
14
- delayedHideTimeout: number | undefined;
15
- devOverlay: HTMLDivElement | undefined;
16
- plugins: DevOverlayPlugin[];
17
- hasBeenInitialized: boolean;
18
- customPluginsToShow: number;
19
- constructor();
20
- /**
21
- * All one-time DOM setup runs through here. Only ever call this once,
22
- * in connectedCallback(), and protect it from being called again.
23
- */
24
- init(): void;
25
- connectedCallback(): void;
26
- attachEvents(): void;
27
- initPlugin(plugin: DevOverlayPlugin): Promise<void>;
28
- getPluginTemplate(plugin: DevOverlayPlugin): string;
29
- getPluginById(id: string): DevOverlayPlugin | undefined;
30
- getPluginCanvasById(id: string): HTMLElement | null;
31
- togglePluginStatus(plugin: DevOverlayPlugin): Promise<void>;
32
- setPluginStatus(plugin: DevOverlayPlugin, newStatus: boolean): Promise<boolean>;
33
- isHidden(): boolean;
34
- getActivePlugin(): DevOverlayPlugin | undefined;
35
- clearDelayedHide(): void;
36
- triggerDelayedHide(): void;
37
- setOverlayVisible(newStatus: boolean): void;
38
- setNotificationVisible(newStatus: boolean): void;
39
- }
40
- export declare class DevOverlayCanvas extends HTMLElement {
41
- shadowRoot: ShadowRoot;
42
- constructor();
43
- connectedCallback(): void;
44
- }
45
- export declare function getPluginIcon(icon: Icon): string;
@@ -1,8 +0,0 @@
1
- import type { DevOverlayHighlight } from '../../ui-library/highlight.js';
2
- import type { Icon } from '../../ui-library/icons.js';
3
- export declare function createHighlight(rect: DOMRect, icon?: Icon): DevOverlayHighlight;
4
- export declare function getElementsPositionInDocument(el: Element): {
5
- isFixed: boolean;
6
- };
7
- export declare function positionHighlight(highlight: DevOverlayHighlight, rect: DOMRect): void;
8
- export declare function attachTooltipToHighlight(highlight: DevOverlayHighlight, tooltip: HTMLElement, originalElement: Element): void;
@@ -1,8 +0,0 @@
1
- export { DevOverlayBadge } from './badge.js';
2
- export { DevOverlayButton } from './button.js';
3
- export { DevOverlayCard } from './card.js';
4
- export { DevOverlayHighlight } from './highlight.js';
5
- export { DevOverlayIcon } from './icon.js';
6
- export { DevOverlayToggle } from './toggle.js';
7
- export { DevOverlayTooltip } from './tooltip.js';
8
- export { DevOverlayWindow } from './window.js';
@@ -1,18 +0,0 @@
1
- import { DevOverlayBadge } from "./badge.js";
2
- import { DevOverlayButton } from "./button.js";
3
- import { DevOverlayCard } from "./card.js";
4
- import { DevOverlayHighlight } from "./highlight.js";
5
- import { DevOverlayIcon } from "./icon.js";
6
- import { DevOverlayToggle } from "./toggle.js";
7
- import { DevOverlayTooltip } from "./tooltip.js";
8
- import { DevOverlayWindow } from "./window.js";
9
- export {
10
- DevOverlayBadge,
11
- DevOverlayButton,
12
- DevOverlayCard,
13
- DevOverlayHighlight,
14
- DevOverlayIcon,
15
- DevOverlayToggle,
16
- DevOverlayTooltip,
17
- DevOverlayWindow
18
- };