astro 1.0.0-beta.49 → 1.0.0-beta.51

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/dist/cli/index.js CHANGED
@@ -40,7 +40,7 @@ function printAstroHelp() {
40
40
  });
41
41
  }
42
42
  async function printVersion() {
43
- const version = "1.0.0-beta.49";
43
+ const version = "1.0.0-beta.51";
44
44
  console.log();
45
45
  console.log(` ${colors.bgGreen(colors.black(` astro `))} ${colors.green(`v${version}`)}`);
46
46
  }
@@ -83,7 +83,7 @@ async function cli(args) {
83
83
  } else if (flags.silent) {
84
84
  logging.level = "silent";
85
85
  }
86
- const telemetry = new AstroTelemetry({ version: "1.0.0-beta.49" });
86
+ const telemetry = new AstroTelemetry({ version: "1.0.0-beta.51" });
87
87
  if (cmd === "telemetry") {
88
88
  try {
89
89
  const subcommand = (_a = flags._[3]) == null ? void 0 : _a.toString();
@@ -97,7 +97,7 @@ async function cli(args) {
97
97
  try {
98
98
  const packages = flags._.slice(3);
99
99
  telemetry.record(event.eventCliSession({
100
- astroVersion: "1.0.0-beta.49",
100
+ astroVersion: "1.0.0-beta.51",
101
101
  cliCommand: "add"
102
102
  }));
103
103
  return await add(packages, { cwd: root, flags, logging, telemetry });
@@ -108,7 +108,7 @@ async function cli(args) {
108
108
  case "dev": {
109
109
  try {
110
110
  const { astroConfig, userConfig } = await openConfig({ cwd: root, flags, cmd });
111
- telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.49", cliCommand: "dev" }, userConfig, flags));
111
+ telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.51", cliCommand: "dev" }, userConfig, flags));
112
112
  await devServer(astroConfig, { logging, telemetry });
113
113
  return await new Promise(() => {
114
114
  });
@@ -119,7 +119,7 @@ async function cli(args) {
119
119
  case "build": {
120
120
  try {
121
121
  const { astroConfig, userConfig } = await openConfig({ cwd: root, flags, cmd });
122
- telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.49", cliCommand: "build" }, userConfig, flags));
122
+ telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.51", cliCommand: "build" }, userConfig, flags));
123
123
  return await build(astroConfig, { logging, telemetry });
124
124
  } catch (err) {
125
125
  return throwAndExit(err);
@@ -127,14 +127,14 @@ async function cli(args) {
127
127
  }
128
128
  case "check": {
129
129
  const { astroConfig, userConfig } = await openConfig({ cwd: root, flags, cmd });
130
- telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.49", cliCommand: "check" }, userConfig, flags));
130
+ telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.51", cliCommand: "check" }, userConfig, flags));
131
131
  const ret = await check(astroConfig);
132
132
  return process.exit(ret);
133
133
  }
134
134
  case "preview": {
135
135
  try {
136
136
  const { astroConfig, userConfig } = await openConfig({ cwd: root, flags, cmd });
137
- telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.49", cliCommand: "preview" }, userConfig, flags));
137
+ telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.51", cliCommand: "preview" }, userConfig, flags));
138
138
  const server = await preview(astroConfig, { logging, telemetry });
139
139
  return await server.closed();
140
140
  } catch (err) {
@@ -144,7 +144,7 @@ async function cli(args) {
144
144
  case "docs": {
145
145
  try {
146
146
  await telemetry.record(event.eventCliSession({
147
- astroVersion: "1.0.0-beta.49",
147
+ astroVersion: "1.0.0-beta.51",
148
148
  cliCommand: "docs"
149
149
  }));
150
150
  return await openInBrowser("https://docs.astro.build/");
@@ -1,4 +1,5 @@
1
1
  import { prependForwardSlash } from "../../core/path.js";
2
+ import { resolveClientDevPath } from "../../core/render/dev/resolve.js";
2
3
  import { getTopLevelPages } from "./graph.js";
3
4
  import { getPageDataByViteID, trackClientOnlyPageDatas } from "./internal.js";
4
5
  function vitePluginAnalyzer(astroConfig, internals) {
@@ -64,13 +65,14 @@ function vitePluginAnalyzer(astroConfig, internals) {
64
65
  continue;
65
66
  const astro = info.meta.astro;
66
67
  for (const c of astro.hydratedComponents) {
67
- internals.discoveredHydratedComponents.add(c.resolvedPath || c.specifier);
68
+ const rid = c.resolvedPath ? resolveClientDevPath(c.resolvedPath) : c.specifier;
69
+ internals.discoveredHydratedComponents.add(rid);
68
70
  }
69
71
  hoistScanner.scan.call(this, astro.scripts, id);
70
72
  if (astro.clientOnlyComponents.length) {
71
73
  const clientOnlys = [];
72
74
  for (const c of astro.clientOnlyComponents) {
73
- const cid = c.resolvedPath || c.specifier;
75
+ const cid = c.resolvedPath ? resolveClientDevPath(c.resolvedPath) : c.specifier;
74
76
  internals.discoveredClientOnlyComponents.add(cid);
75
77
  clientOnlys.push(cid);
76
78
  }
@@ -47,7 +47,7 @@ async function dev(config, options) {
47
47
  site,
48
48
  https: !!((_a = viteConfig.server) == null ? void 0 : _a.https)
49
49
  }));
50
- const currentVersion = "1.0.0-beta.49";
50
+ const currentVersion = "1.0.0-beta.51";
51
51
  if (currentVersion.includes("-")) {
52
52
  warn(options.logging, null, msg.prerelease({ currentVersion }));
53
53
  }
@@ -47,7 +47,7 @@ function devStart({
47
47
  https,
48
48
  site
49
49
  }) {
50
- const version = "1.0.0-beta.49";
50
+ const version = "1.0.0-beta.51";
51
51
  const rootPath = site ? site.pathname : "/";
52
52
  const localPrefix = `${dim("\u2503")} Local `;
53
53
  const networkPrefix = `${dim("\u2503")} Network `;
@@ -207,7 +207,7 @@ function printHelp({
207
207
  };
208
208
  let message = [];
209
209
  if (headline) {
210
- message.push(linebreak(), ` ${bgGreen(black(` ${commandName} `))} ${green(`v${"1.0.0-beta.49"}`)} ${headline}`);
210
+ message.push(linebreak(), ` ${bgGreen(black(` ${commandName} `))} ${green(`v${"1.0.0-beta.51"}`)} ${headline}`);
211
211
  }
212
212
  if (usage) {
213
213
  message.push(linebreak(), ` ${green(commandName)} ${bold(usage)}`);
@@ -25,6 +25,7 @@ import { createModuleScriptElementWithSrcSet } from "../ssr-element.js";
25
25
  import { collectMdMetadata } from "../util.js";
26
26
  import { getStylesForURL } from "./css.js";
27
27
  import { injectTags } from "./html.js";
28
+ import { resolveClientDevPath } from "./resolve.js";
28
29
  const svelteStylesRE = /svelte\?svelte&type=style/;
29
30
  async function loadRenderer(viteServer, renderer) {
30
31
  var _a;
@@ -118,7 +119,7 @@ async function render(renderers, mod, ssrOpts) {
118
119
  scripts,
119
120
  async resolve(s) {
120
121
  if (s.startsWith("/@fs")) {
121
- return s;
122
+ return resolveClientDevPath(s);
122
123
  }
123
124
  return "/@id" + prependForwardSlash(s);
124
125
  },
@@ -0,0 +1,11 @@
1
+ function resolveClientDevPath(id) {
2
+ if (id.startsWith("/@fs")) {
3
+ if (id.endsWith(".jsx")) {
4
+ return id.slice(0, id.length - 4);
5
+ }
6
+ }
7
+ return id;
8
+ }
9
+ export {
10
+ resolveClientDevPath
11
+ };
@@ -9,7 +9,14 @@ class Metadata {
9
9
  this.metadataCache = /* @__PURE__ */ new Map();
10
10
  }
11
11
  resolvePath(specifier) {
12
- return specifier.startsWith(".") ? new URL(specifier, this.mockURL).pathname : specifier;
12
+ if (specifier.startsWith(".")) {
13
+ const resolved = new URL(specifier, this.mockURL).pathname;
14
+ if (resolved.startsWith("/@fs") && resolved.endsWith(".jsx")) {
15
+ return resolved.slice(0, resolved.length - 4);
16
+ }
17
+ return resolved;
18
+ }
19
+ return specifier;
13
20
  }
14
21
  getPath(Component) {
15
22
  const metadata = this.getComponentMetadata(Component);
@@ -0,0 +1 @@
1
+ export declare function resolveClientDevPath(id: string): string;
@@ -208,7 +208,7 @@ ${tsResult}`;
208
208
  };
209
209
  }
210
210
  function escapeViteEnvReferences(code) {
211
- return code.replace(/import\.meta\.env\./g, "import\\u002Emeta.env.");
211
+ return code.replace(/import\.meta\.env/g, "import\\u002Emeta.env");
212
212
  }
213
213
  export {
214
214
  markdown as default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "1.0.0-beta.49",
3
+ "version": "1.0.0-beta.51",
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",