summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.changeset/neat-owls-run.md25
-rw-r--r--packages/astro/package.json5
-rw-r--r--packages/astro/src/core/compile/compile.ts2
-rw-r--r--packages/astro/src/runtime/README.md1
-rw-r--r--packages/astro/src/runtime/compiler/index.ts20
-rw-r--r--packages/astro/src/runtime/server/index.ts2
-rw-r--r--packages/astro/src/vite-plugin-mdx/tag.ts4
7 files changed, 53 insertions, 6 deletions
diff --git a/.changeset/neat-owls-run.md b/.changeset/neat-owls-run.md
new file mode 100644
index 000000000..501b5319f
--- /dev/null
+++ b/.changeset/neat-owls-run.md
@@ -0,0 +1,25 @@
+---
+'astro': major
+---
+
+Remove exports for `astro/internal/*` and `astro/runtime/server/*` in favour of `astro/runtime/*`. Add new `astro/compiler-runtime` export for compiler-specific runtime code.
+
+These are exports for Astro's internal API and should not affect your project, but if you do use these entrypoints, you can migrate like below:
+
+```diff
+- import 'astro/internal/index.js';
++ import 'astro/runtime/server/index.js';
+
+- import 'astro/server/index.js';
++ import 'astro/runtime/server/index.js';
+```
+
+```diff
+import { transform } from '@astrojs/compiler';
+
+const result = await transform(source, {
+- internalURL: 'astro/runtime/server/index.js',
++ internalURL: 'astro/compiler-runtime',
+ // ...
+});
+```
diff --git a/packages/astro/package.json b/packages/astro/package.json
index b21c4b334..18918f934 100644
--- a/packages/astro/package.json
+++ b/packages/astro/package.json
@@ -42,6 +42,8 @@
"./tsconfigs/*": "./tsconfigs/*.json",
"./jsx/*": "./dist/jsx/*",
"./jsx-runtime": "./dist/jsx-runtime/index.js",
+ "./compiler-runtime": "./dist/runtime/compiler/index.js",
+ "./runtime/*": "./dist/runtime/*",
"./config": {
"types": "./config.d.ts",
"default": "./config.mjs"
@@ -60,10 +62,7 @@
"./content/runtime": "./dist/content/runtime.js",
"./content/runtime-assets": "./dist/content/runtime-assets.js",
"./debug": "./components/Debug.astro",
- "./internal/*": "./dist/runtime/server/*",
"./package.json": "./package.json",
- "./runtime/*": "./dist/runtime/*",
- "./server/*": "./dist/runtime/server/*",
"./zod": {
"types": "./zod.d.ts",
"default": "./zod.mjs"
diff --git a/packages/astro/src/core/compile/compile.ts b/packages/astro/src/core/compile/compile.ts
index f266c0b16..bd069611d 100644
--- a/packages/astro/src/core/compile/compile.ts
+++ b/packages/astro/src/core/compile/compile.ts
@@ -41,7 +41,7 @@ export async function compile({
filename,
normalizedFilename: normalizeFilename(filename, astroConfig.root),
sourcemap: 'both',
- internalURL: 'astro/server/index.js',
+ internalURL: 'astro/compiler-runtime',
astroGlobalArgs: JSON.stringify(astroConfig.site),
scopedStyleStrategy: astroConfig.scopedStyleStrategy,
resultScopedSlot: true,
diff --git a/packages/astro/src/runtime/README.md b/packages/astro/src/runtime/README.md
index a11a98d8c..68225fed1 100644
--- a/packages/astro/src/runtime/README.md
+++ b/packages/astro/src/runtime/README.md
@@ -4,5 +4,6 @@ Code that executes within isolated contexts:
- `client/`: executes within the browser. Astro’s client-side partial hydration code lives here, and only browser-compatible code can be used.
- `server/`: executes inside Vite SSR. Though also a Node context, this is isolated from code in `core/`.
+- `compiler/`: same as `server/`, but only used by the Astro compiler `internalURL` option.
[See CONTRIBUTING.md](../../../../CONTRIBUTING.md) for a code overview.
diff --git a/packages/astro/src/runtime/compiler/index.ts b/packages/astro/src/runtime/compiler/index.ts
new file mode 100644
index 000000000..a5c238b68
--- /dev/null
+++ b/packages/astro/src/runtime/compiler/index.ts
@@ -0,0 +1,20 @@
+// NOTE: Although this entrypoint is exported, it is internal API and may change at any time.
+
+export {
+ Fragment,
+ render,
+ createAstro,
+ createComponent,
+ renderComponent,
+ renderHead,
+ maybeRenderHead,
+ unescapeHTML,
+ renderSlot,
+ mergeSlots,
+ addAttribute,
+ renderTransition,
+ createTransitionScope,
+ spreadAttributes,
+ defineStyleVars,
+ defineScriptVars,
+} from '../server/index.js';
diff --git a/packages/astro/src/runtime/server/index.ts b/packages/astro/src/runtime/server/index.ts
index 5d4697bc7..81d05987a 100644
--- a/packages/astro/src/runtime/server/index.ts
+++ b/packages/astro/src/runtime/server/index.ts
@@ -1,3 +1,5 @@
+// NOTE: Although this entrypoint is exported, it is internal API and may change at any time.
+
export { createComponent } from './astro-component.js';
export { createAstro } from './astro-global.js';
export { renderEndpoint } from './endpoint.js';
diff --git a/packages/astro/src/vite-plugin-mdx/tag.ts b/packages/astro/src/vite-plugin-mdx/tag.ts
index 5efc4c41f..b7ae1f2c4 100644
--- a/packages/astro/src/vite-plugin-mdx/tag.ts
+++ b/packages/astro/src/vite-plugin-mdx/tag.ts
@@ -18,7 +18,7 @@ export default async function tagExportsWithRenderer({
return {
visitor: {
Program: {
- // Inject `import { __astro_tag_component__ } from 'astro/server/index.js'`
+ // Inject `import { __astro_tag_component__ } from 'astro/runtime/server/index.js'`
enter(path) {
path.node.body.splice(
0,
@@ -30,7 +30,7 @@ export default async function tagExportsWithRenderer({
t.identifier('__astro_tag_component__')
),
],
- t.stringLiteral('astro/server/index.js')
+ t.stringLiteral('astro/runtime/server/index.js')
)
);
},