Compare commits

...

2 commits

Author SHA1 Message Date
Princesseuh
9959899b5e
config: use moduleResolution node16 2023-07-24 20:48:40 +02:00
Erika
cb973ee1e2
Remove support for Node 16 (#7780) 2023-07-24 20:47:07 +02:00
257 changed files with 555 additions and 484 deletions

View file

@ -0,0 +1,32 @@
---
'@astrojs/cloudflare': major
'@astrojs/partytown': major
'@astrojs/tailwind': major
'@astrojs/netlify': major
'@astrojs/sitemap': major
'@astrojs/preact': major
'@astrojs/svelte': major
'@astrojs/vercel': major
'@astrojs/react': major
'@astrojs/solid-js': major
'@astrojs/deno': major
'@astrojs/node': major
'@astrojs/lit': major
'@astrojs/vue': major
'create-astro': major
'@astrojs/prism': major
'@astrojs/rss': major
'@astrojs/telemetry': major
'@astrojs/webapi': major
'astro': major
'@astrojs/turbolinks': minor
'@astrojs/alpinejs': minor
'@astrojs/prefetch': minor
'@astrojs/markdoc': minor
'@astrojs/underscore-redirects': minor
'@astrojs/image': minor
'@astrojs/mdx': minor
'@astrojs/internal-helpers': minor
---
Remove support for Node 16. The lowest supported version by Astro and all integrations is now v18.14.1. As a reminder, Node 16 will be deprecated on the 11th September 2023.

View file

@ -10,7 +10,7 @@ body:
Thank you for taking the time to file a bug report! Please fill out this form as completely as possible.
✅ I am using the **latest version of Astro** and all plugins.
✅ I am using a version of Node that supports ESM (`v14.18.0+`, or `v16.12.0+`)
✅ I am using a version of Node that Astro supports (`>=18.14.1`)
- type: input
id: astro-version
attributes:

View file

@ -33,7 +33,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: "pnpm"
- name: Install dependencies

View file

@ -38,7 +38,7 @@ jobs:
strategy:
matrix:
OS: [ubuntu-latest, windows-latest]
NODE_VERSION: [16]
NODE_VERSION: [18]
fail-fast: true
steps:
# Disable crlf so all OS can share the same Turbo cache
@ -85,7 +85,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: "pnpm"
- name: Install dependencies
@ -108,12 +108,12 @@ jobs:
strategy:
matrix:
OS: [ubuntu-latest]
NODE_VERSION: [16, 18]
NODE_VERSION: [18, 20]
include:
- os: macos-latest
NODE_VERSION: 16
NODE_VERSION: 18
- os: windows-latest
NODE_VERSION: 16
NODE_VERSION: 18
fail-fast: false
env:
NODE_VERSION: ${{ matrix.NODE_VERSION }}
@ -155,7 +155,7 @@ jobs:
strategy:
matrix:
OS: [ubuntu-latest, windows-latest]
NODE_VERSION: [16]
NODE_VERSION: [18]
fail-fast: false
env:
NODE_VERSION: ${{ matrix.NODE_VERSION }}
@ -192,7 +192,7 @@ jobs:
strategy:
matrix:
OS: [ubuntu-latest, windows-latest]
NODE_VERSION: [16]
NODE_VERSION: [18]
env:
NODE_VERSION: ${{ matrix.NODE_VERSION }}
steps:

View file

@ -38,7 +38,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: "pnpm"
- name: Install dependencies

View file

@ -29,7 +29,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: "pnpm"
- name: Install dependencies

View file

@ -37,7 +37,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: "pnpm"
- name: Install dependencies

View file

@ -58,7 +58,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
registry-url: "https://registry.npmjs.org"
cache: "pnpm"

2
.nvmrc
View file

@ -1 +1 @@
16.19.0
18.14.1

3
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,3 @@
{
"typescript.preferences.importModuleSpecifierEnding": "js"
}

View file

@ -10,7 +10,7 @@ We welcome contributions of any size and skill level. As an open source project,
### Prerequisites
```shell
node: "^>=16.12.0"
node: "^>=18.14.1"
pnpm: "^8.6.2"
# otherwise, your build will fail
```

View file

@ -3,8 +3,8 @@
"include": ["src"],
"compilerOptions": {
"allowJs": true,
"module": "ES2020",
"module": "ES2022",
"outDir": "./dist",
"target": "ES2020"
"target": "ES2022"
}
}

View file

@ -39,7 +39,7 @@
"packages/*"
],
"engines": {
"node": ">=16.12.0",
"node": ">=18.14.1",
"pnpm": ">=8.6.2"
},
"packageManager": "pnpm@8.6.2",
@ -82,7 +82,7 @@
"@types/node": "^18.16.18",
"@typescript-eslint/eslint-plugin": "6.0.0",
"@typescript-eslint/parser": "6.0.0",
"esbuild": "^0.17.19",
"esbuild": "^0.18.16",
"eslint": "^8.43.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-no-only-tests": "^2.6.0",
@ -93,6 +93,6 @@
"prettier-plugin-astro": "^0.10.0",
"tiny-glob": "^0.2.9",
"turbo": "^1.10.3",
"typescript": "~5.0.2"
"typescript": "~5.1.6"
}
}

View file

@ -14,7 +14,7 @@
"homepage": "https://docs.astro.build/en/reference/api-reference/#prism-",
"main": "dist/index.js",
"scripts": {
"build": "astro-scripts build \"src/**/*.ts\" && tsc",
"build": "astro-scripts build \"src/**/*.ts\" && tsc -p ./tsconfig.json",
"build:ci": "astro-scripts build \"src/**/*.ts\"",
"dev": "astro-scripts dev \"src/**/*.ts\""
},
@ -39,6 +39,6 @@
"astro-scripts": "workspace:*"
},
"engines": {
"node": ">=16.12.0"
"node": ">=18.14.1"
}
}

View file

@ -3,7 +3,7 @@
"include": ["src"],
"compilerOptions": {
"allowJs": true,
"target": "ES2021",
"target": "ES2022",
"module": "ES2022",
"outDir": "./dist"
}

View file

@ -1,5 +1,5 @@
import type { z } from 'astro/zod';
import type { RSSOptions } from './index';
import type { RSSOptions } from './index.js';
/** Normalize URL to its canonical form */
export function createCanonicalURL(

View file

@ -5,7 +5,7 @@
"allowJs": true,
"module": "ES2022",
"outDir": "./dist",
"target": "ES2021",
"target": "ES2022",
"strictNullChecks": true
}
}

View file

@ -13,8 +13,8 @@ const CI_INSTRUCTIONS = {
};
// Hardcode supported Node.js version so we don't have to read differently in CJS & ESM.
const engines = '>=16.12.0';
const skipSemverCheckIfAbove = 16;
const engines = '>=18.14.1';
const skipSemverCheckIfAbove = 19;
/** `astro *` */
async function main() {

View file

@ -57,7 +57,7 @@ declare module 'astro:assets' {
type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
type Simplify<T> = { [KeyType in keyof T]: T[KeyType] };
type ImgAttributes = WithRequired<
Omit<import('./types').HTMLAttributes<'img'>, 'src' | 'width' | 'height'>,
Omit<import('./types.js').HTMLAttributes<'img'>, 'src' | 'width' | 'height'>,
'alt'
>;
@ -79,7 +79,7 @@ declare module 'astro:transitions' {
export const ViewTransitions: ViewTransitionsModule['default'];
}
type MD = import('./dist/@types/astro').MarkdownInstance<Record<string, any>>;
type MD = import('./dist/@types/astro.js').MarkdownInstance<Record<string, any>>;
interface ExportedMarkdownModuleEntities {
frontmatter: MD['frontmatter'];
file: MD['file'];
@ -184,7 +184,7 @@ declare module '*.mdown' {
}
declare module '*.mdx' {
type MDX = import('./dist/@types/astro').MDXInstance<Record<string, any>>;
type MDX = import('./dist/@types/astro.js').MDXInstance<Record<string, any>>;
export const frontmatter: MDX['frontmatter'];
export const file: MDX['file'];
@ -197,7 +197,7 @@ declare module '*.mdx' {
}
declare module 'astro:ssr-manifest' {
export const manifest: import('./dist/@types/astro').SSRManifest;
export const manifest: import('./dist/@types/astro.js').SSRManifest;
}
// Everything below are Vite's types (apart from image types, which are in `client.d.ts`)

View file

@ -141,8 +141,8 @@
"devalue": "^4.3.2",
"diff": "^5.1.0",
"es-module-lexer": "^1.3.0",
"esbuild": "^0.17.19",
"estree-walker": "3.0.0",
"esbuild": "^0.18.16",
"estree-walker": "^3.0.3",
"execa": "^6.1.0",
"fast-glob": "^3.2.12",
"github-slugger": "^2.0.0",
@ -150,7 +150,7 @@
"html-escaper": "^3.0.3",
"js-yaml": "^4.1.0",
"kleur": "^4.1.4",
"magic-string": "^0.27.0",
"magic-string": "^0.30.1",
"mime": "^3.0.0",
"network-information-types": "^0.1.1",
"ora": "^6.3.1",
@ -224,7 +224,7 @@
}
},
"engines": {
"node": ">=16.12.0",
"node": ">=18.14.1",
"npm": ">=6.14.0"
}
}

View file

@ -14,13 +14,13 @@ import type * as rollup from 'rollup';
import type { TsConfigJson } from 'tsconfig-resolver';
import type * as vite from 'vite';
import type { z } from 'zod';
import type { SerializedSSRManifest } from '../core/app/types';
import type { PageBuildData } from '../core/build/types';
import type { AstroConfigSchema } from '../core/config';
import type { AstroTimer } from '../core/config/timer';
import type { AstroCookies } from '../core/cookies';
import type { LogOptions } from '../core/logger/core';
import type { AstroComponentFactory, AstroComponentInstance } from '../runtime/server';
import type { SerializedSSRManifest } from '../core/app/types.js';
import type { PageBuildData } from '../core/build/types.js';
import type { AstroConfigSchema } from '../core/config/index.js';
import type { AstroTimer } from '../core/config/timer.js';
import type { AstroCookies } from '../core/cookies/index.js';
import type { LogOptions } from '../core/logger/core.js';
import type { AstroComponentFactory, AstroComponentInstance } from '../runtime/server/index.js';
import type { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../core/constants.js';
export type {
MarkdownHeading,
@ -34,7 +34,7 @@ export type {
ExternalImageService,
ImageService,
LocalImageService,
} from '../assets/services/service';
} from '../assets/services/service.js';
export type {
GetImageResult,
ImageInputFormat,
@ -43,9 +43,9 @@ export type {
ImageQuality,
ImageQualityPreset,
ImageTransform,
} from '../assets/types';
export type { SSRManifest } from '../core/app/types';
export type { AstroCookies } from '../core/cookies';
} from '../assets/types.js';
export type { SSRManifest } from '../core/app/types.js';
export type { AstroCookies } from '../core/cookies/index.js';
export interface AstroBuiltinProps {
'client:load'?: boolean;

View file

@ -33,7 +33,7 @@ export interface RotateOptions {
}
// MozJPEG
import type { MozJPEGModule as MozJPEGEncodeModule } from './mozjpeg/mozjpeg_enc'
import type { MozJPEGModule as MozJPEGEncodeModule } from './mozjpeg/mozjpeg_enc.js'
import mozDec from './mozjpeg/mozjpeg_node_dec.js'
import mozDecWasm from './mozjpeg/mozjpeg_node_dec.wasm.js'
@ -41,7 +41,7 @@ import mozEnc from './mozjpeg/mozjpeg_node_enc.js'
import mozEncWasm from './mozjpeg/mozjpeg_node_enc.wasm.js'
// WebP
import type { WebPModule as WebPEncodeModule } from './webp/webp_enc'
import type { WebPModule as WebPEncodeModule } from './webp/webp_enc.js'
import webpDec from './webp/webp_node_dec.js'
import webpDecWasm from './webp/webp_node_dec.wasm.js'
@ -49,7 +49,7 @@ import webpEnc from './webp/webp_node_enc.js'
import webpEncWasm from './webp/webp_node_enc.wasm.js'
// AVIF
import type { AVIFModule as AVIFEncodeModule } from './avif/avif_enc'
import type { AVIFModule as AVIFEncodeModule } from './avif/avif_enc.js'
import avifDec from './avif/avif_node_dec.js'
import avifDecWasm from './avif/avif_node_dec.wasm.js'

View file

@ -1,4 +1,4 @@
import type { IImage } from './interface'
import type { IImage } from './interface.js'
export const BMP: IImage = {
validate(buffer) {

View file

@ -1,5 +1,5 @@
import { ICO } from './ico.js'
import type { IImage } from './interface'
import type { IImage } from './interface.js'
const TYPE_CURSOR = 2
export const CUR: IImage = {

View file

@ -1,4 +1,4 @@
import type { IImage } from './interface'
import type { IImage } from './interface.js'
export const DDS: IImage = {
validate(buffer) {

View file

@ -1,4 +1,4 @@
import type { IImage } from './interface'
import type { IImage } from './interface.js'
const gifRegexp = /^GIF8[79]a/
export const GIF: IImage = {

View file

@ -1,4 +1,4 @@
import type { IImage, ISize } from './interface'
import type { IImage, ISize } from './interface.js'
/**
* ICNS Header

View file

@ -1,4 +1,4 @@
import type { IImage, ISize, ISizeCalculationResult } from './interface'
import type { IImage, ISize, ISizeCalculationResult } from './interface.js'
const TYPE_ICON = 1

View file

@ -1,4 +1,4 @@
import type { IImage } from './interface'
import type { IImage } from './interface.js'
export const J2C: IImage = {
validate(buffer) {

View file

@ -1,4 +1,4 @@
import type { IImage, ISize } from './interface'
import type { IImage, ISize } from './interface.js'
const BoxTypes = {
ftyp: '66747970',

View file

@ -4,7 +4,7 @@
// if this range we can't detect the file size correctly.
import { readUInt } from '../readUInt.js'
import type { IImage, ISize } from './interface'
import type { IImage, ISize } from './interface.js'
const EXIF_MARKER = '45786966'
const APP1_DATA_SIZE_BYTES = 2

View file

@ -1,4 +1,4 @@
import type { IImage } from './interface'
import type { IImage } from './interface.js'
const SIGNATURE = 'KTX 11'

View file

@ -1,4 +1,4 @@
import type { IImage } from './interface'
import type { IImage } from './interface.js'
const pngSignature = 'PNG\r\n\x1a\n'
const pngImageHeaderChunkName = 'IHDR'

View file

@ -1,4 +1,4 @@
import type { IImage, ISize } from './interface'
import type { IImage, ISize } from './interface.js'
const PNMTypes: { [signature: string]: string } = {
P1: 'pbm/ascii',

View file

@ -1,4 +1,4 @@
import type { IImage } from './interface'
import type { IImage } from './interface.js'
export const PSD: IImage = {
validate(buffer) {

View file

@ -1,4 +1,4 @@
import type { IImage, ISize } from './interface'
import type { IImage, ISize } from './interface.js'
interface IAttributes {
width: number | null

View file

@ -2,7 +2,7 @@
// TO-DO: support big-endian as well
import * as fs from 'node:fs'
import { readUInt } from '../readUInt.js'
import type { IImage } from './interface'
import type { IImage } from './interface.js'
// Read IFD (image-file-directory) into a buffer
function readIFD(buffer: Buffer, filepath: string, isBigEndian: boolean) {

View file

@ -1,5 +1,5 @@
// based on https://developers.google.com/speed/webp/docs/riff_container
import type { IImage, ISize } from './interface'
import type { IImage, ISize } from './interface.js'
function calculateExtended(buffer: Buffer): ISize {
return {

View file

@ -3,7 +3,7 @@ import MagicString from 'magic-string';
import { fileURLToPath } from 'node:url';
import type * as vite from 'vite';
import { normalizePath } from 'vite';
import type { AstroPluginOptions, ImageTransform } from '../@types/astro';
import type { AstroPluginOptions, ImageTransform } from '../@types/astro.js';
import { error } from '../core/logger/core.js';
import {
appendForwardSlash,

View file

@ -3,13 +3,11 @@ import parser from '@babel/parser';
import traverse from '@babel/traverse';
import * as t from '@babel/types';
// @ts-expect-error @babel/traverse isn't ESM and needs this trick
export const visit = traverse.default as typeof traverse;
export const visit = traverse.default;
export { t };
export async function generate(ast: t.File) {
// @ts-expect-error @babel/generator isn't ESM and needs this trick
const astToText = generator.default as typeof generator;
const astToText = generator.default;
const { code } = astToText(ast);
return code;
}

View file

@ -12,11 +12,11 @@ import { join } from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import ora from 'ora';
import type { Arguments as Flags } from 'yargs-parser';
import type { AstroSettings } from '../../@types/astro';
import type { AstroSettings } from '../../@types/astro.js';
import type { LogOptions } from '../../core/logger/core.js';
import { debug, info } from '../../core/logger/core.js';
import { printHelp } from '../../core/messages.js';
import type { ProcessExit, SyncOptions } from '../../core/sync';
import type { ProcessExit, SyncOptions } from '../../core/sync/index.js';
import { loadSettings } from '../load-settings.js';
import { printDiagnostic } from './print.js';

View file

@ -1,6 +1,6 @@
import type { UserConfig } from 'vite';
import type { AstroUserConfig } from '../@types/astro';
import type { LogOptions } from '../core/logger/core';
import type { AstroUserConfig } from '../@types/astro.js';
import type { LogOptions } from '../core/logger/core.js';
export function defineConfig(config: AstroUserConfig) {
return config;

View file

@ -1,6 +1,6 @@
import type fsMod from 'node:fs';
import type { Plugin, ViteDevServer } from 'vite';
import type { AstroSettings } from '../@types/astro';
import type { AstroSettings } from '../@types/astro.js';
import { attachContentServerListeners } from '../content/server-listeners.js';
import type { LogOptions } from '../core/logger/core.js';

View file

@ -5,7 +5,7 @@ import type { AstroSettings } from '../@types/astro.js';
import { moduleIsTopLevelPage, walkParentInfos } from '../core/build/graph.js';
import { getPageDataByViteID, type BuildInternals } from '../core/build/internal.js';
import type { AstroBuildPlugin } from '../core/build/plugin.js';
import type { StaticBuildOptions } from '../core/build/types';
import type { StaticBuildOptions } from '../core/build/types.js';
import type { ModuleLoader } from '../core/module-loader/loader.js';
import { createViteLoader } from '../core/module-loader/vite.js';
import { joinPaths, prependForwardSlash } from '../core/path.js';

View file

@ -1,5 +1,5 @@
import { deserializeRouteData } from '../routing/manifest/serialization.js';
import type { RouteInfo, SerializedSSRManifest, SSRManifest } from './types';
import type { RouteInfo, SerializedSSRManifest, SSRManifest } from './types.js';
export function deserializeManifest(serializedManifest: SerializedSSRManifest): SSRManifest {
const routes: RouteInfo[] = [];

View file

@ -5,14 +5,14 @@ import type {
RouteData,
SSRElement,
SSRManifest,
} from '../../@types/astro';
import type { SinglePageBuiltModule } from '../build/types';
} from '../../@types/astro.js';
import type { SinglePageBuiltModule } from '../build/types.js';
import { attachToResponse, getSetCookiesFromResponse } from '../cookies/index.js';
import { consoleLogDestination } from '../logger/console.js';
import { error, type LogOptions } from '../logger/core.js';
import { prependForwardSlash, removeTrailingForwardSlash } from '../path.js';
import { RedirectSinglePageBuiltModule } from '../redirects/index.js';
import { isResponse } from '../render/core';
import { isResponse } from '../render/core.js';
import {
createEnvironment,
createRenderContext,
@ -27,7 +27,7 @@ import {
createStylesheetElementSet,
} from '../render/ssr-element.js';
import { matchRoute } from '../routing/match.js';
import type { RouteInfo } from './types';
import type { RouteInfo } from './types.js';
export { deserializeManifest } from './common.js';
const clientLocalsSymbol = Symbol.for('astro.locals');

View file

@ -1,5 +1,5 @@
import type { RouteData } from '../../@types/astro';
import type { SerializedSSRManifest, SSRManifest } from './types';
import type { RouteData } from '../../@types/astro.js';
import type { SerializedSSRManifest, SSRManifest } from './types.js';
import * as fs from 'node:fs';
import { IncomingMessage } from 'node:http';

View file

@ -5,8 +5,8 @@ import type {
SSRComponentMetadata,
SSRLoadedRenderer,
SSRResult,
} from '../../@types/astro';
import type { SinglePageBuiltModule } from '../build/types';
} from '../../@types/astro.js';
import type { SinglePageBuiltModule } from '../build/types.js';
export type ComponentPath = string;

View file

@ -1,6 +1,6 @@
import npath from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import type { AstroConfig, RouteType } from '../../@types/astro';
import type { AstroConfig, RouteType } from '../../@types/astro.js';
import { appendForwardSlash } from '../../core/path.js';
const STATUS_CODE_PAGES = new Set(['/404', '/500']);

View file

@ -2,7 +2,7 @@ import type { GetModuleInfo } from 'rollup';
import crypto from 'node:crypto';
import npath from 'node:path';
import type { AstroSettings } from '../../@types/astro';
import type { AstroSettings } from '../../@types/astro.js';
import { viteID } from '../util.js';
import { getTopLevelPages } from './graph.js';

View file

@ -15,7 +15,7 @@ import type {
SSRError,
SSRLoadedRenderer,
SSRManifest,
} from '../../@types/astro';
} from '../../@types/astro.js';
import {
generateImage as generateImageInternal,
getStaticImageList,
@ -61,7 +61,7 @@ import type {
SinglePageBuiltModule,
StaticBuildOptions,
StylesheetAsset,
} from './types';
} from './types.js';
import { getTimeStat } from './util.js';
function createEntryURL(filePath: string, outFolder: URL) {

View file

@ -3,7 +3,7 @@ import fs from 'node:fs';
import { performance } from 'node:perf_hooks';
import type * as vite from 'vite';
import type yargs from 'yargs-parser';
import type { AstroConfig, AstroSettings, ManifestData, RuntimeMode } from '../../@types/astro';
import type { AstroConfig, AstroSettings, ManifestData, RuntimeMode } from '../../@types/astro.js';
import {
runHookBuildDone,
runHookBuildStart,

View file

@ -1,6 +1,6 @@
import type { Rollup } from 'vite';
import type { RouteData, SSRResult } from '../../@types/astro';
import type { PageOptions } from '../../vite-plugin-astro/types';
import type { RouteData, SSRResult } from '../../@types/astro.js';
import type { PageOptions } from '../../vite-plugin-astro/types.js';
import { prependForwardSlash, removeFileExtension } from '../path.js';
import { viteID } from '../util.js';
import {
@ -9,7 +9,7 @@ import {
} from './plugins/plugin-pages.js';
import { RESOLVED_SPLIT_MODULE_ID } from './plugins/plugin-ssr.js';
import { ASTRO_PAGE_EXTENSION_POST_PATTERN } from './plugins/util.js';
import type { PageBuildData, StylesheetAsset, ViteID } from './types';
import type { PageBuildData, StylesheetAsset, ViteID } from './types.js';
export interface BuildInternals {
/**

View file

@ -1,7 +1,7 @@
import type { AstroSettings, ManifestData } from '../../@types/astro';
import type { LogOptions } from '../logger/core';
import type { AstroSettings, ManifestData } from '../../@types/astro.js';
import type { LogOptions } from '../logger/core.js';
import { info } from '../logger/core.js';
import type { AllPagesData } from './types';
import type { AllPagesData } from './types.js';
import * as colors from 'kleur/colors';
import { debug } from '../logger/core.js';

View file

@ -1,6 +1,6 @@
import type { Plugin as VitePlugin } from 'vite';
import type { BuildInternals } from './internal';
import type { StaticBuildOptions, ViteBuildReturn } from './types';
import type { BuildInternals } from './internal.js';
import type { StaticBuildOptions, ViteBuildReturn } from './types.js';
type RollupOutputArray = Extract<ViteBuildReturn, Array<any>>;
type OutputChunkorAsset = RollupOutputArray[number]['output'][number];

View file

@ -1,6 +1,6 @@
import { astroConfigBuildPlugin } from '../../../content/vite-plugin-content-assets.js';
import { astroHeadBuildPlugin } from '../../../vite-plugin-head/index.js';
import type { AstroBuildPluginContainer } from '../plugin';
import type { AstroBuildPluginContainer } from '../plugin.js';
import { pluginAliasResolve } from './plugin-alias-resolve.js';
import { pluginAnalyzer } from './plugin-analyzer.js';
import { pluginComponentEntry } from './plugin-component-entry.js';

View file

@ -1,6 +1,7 @@
import type { Node as ESTreeNode } from 'estree-walker';
import type { ModuleInfo, PluginContext } from 'rollup';
import type { Plugin as VitePlugin } from 'vite';
import type { PluginMetadata as AstroPluginMetadata } from '../../../vite-plugin-astro/types';
import type { PluginMetadata as AstroPluginMetadata } from '../../../vite-plugin-astro/types.js';
import type { BuildInternals } from '../internal.js';
import type { AstroBuildPlugin } from '../plugin.js';
@ -36,7 +37,7 @@ async function doesParentImportChild(
const imports: Array<ImportDeclaration> = [];
const exports: Array<ExportNamedDeclaration | ExportDefaultDeclaration> = [];
walk(parentInfo.ast, {
walk(parentInfo.ast as ESTreeNode, {
enter(node) {
if (node.type === 'ImportDeclaration') {
imports.push(node as ImportDeclaration);

View file

@ -3,9 +3,9 @@ import * as npath from 'node:path';
import type { GetModuleInfo } from 'rollup';
import { type ResolvedConfig, type Plugin as VitePlugin } from 'vite';
import { isBuildableCSSRequest } from '../../../vite-plugin-astro-server/util.js';
import type { BuildInternals } from '../internal';
import type { AstroBuildPlugin } from '../plugin';
import type { PageBuildData, StaticBuildOptions, StylesheetAsset } from '../types';
import type { BuildInternals } from '../internal.js';
import type { AstroBuildPlugin } from '../plugin.js';
import type { OutputChunk, PageBuildData, StaticBuildOptions, StylesheetAsset } from '../types.js';
import { PROPAGATED_ASSET_FLAG } from '../../../content/consts.js';
import * as assetName from '../css-asset-name.js';
@ -110,7 +110,7 @@ function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[] {
for (const [, chunk] of Object.entries(bundle)) {
if (chunk.type !== 'chunk') continue;
if ('viteMetadata' in chunk === false) continue;
const meta = chunk.viteMetadata as ViteMetadata;
const meta = (chunk as OutputChunk & { viteMetadata: ViteMetadata }).viteMetadata;
// Skip if the chunk has no CSS, we want to handle CSS chunks only
if (meta.importedCss.size < 1) continue;

View file

@ -1,10 +1,10 @@
import type { Plugin as VitePlugin } from 'vite';
import type { AstroSettings } from '../../../@types/astro';
import type { AstroSettings } from '../../../@types/astro.js';
import { viteID } from '../../util.js';
import type { BuildInternals } from '../internal.js';
import { getPageDataByViteID } from '../internal.js';
import type { AstroBuildPlugin } from '../plugin';
import type { OutputChunk, StaticBuildOptions } from '../types';
import type { AstroBuildPlugin } from '../plugin.js';
import type { OutputChunk, StaticBuildOptions } from '../types.js';
function virtualHoistedEntry(id: string) {
return id.startsWith('/astro/hoisted.js?q=');

View file

@ -1,6 +1,6 @@
import type { UserConfig, Plugin as VitePlugin } from 'vite';
import type { BuildInternals } from '../internal.js';
import type { AstroBuildPlugin } from '../plugin';
import type { AstroBuildPlugin } from '../plugin.js';
import { normalizeEntryId } from './plugin-component-entry.js';
export function vitePluginInternals(input: Set<string>, internals: BuildInternals): VitePlugin {

View file

@ -1,9 +1,9 @@
import type { Plugin as VitePlugin } from 'vite';
import { MIDDLEWARE_PATH_SEGMENT_NAME } from '../../constants.js';
import { addRollupInput } from '../add-rollup-input.js';
import type { BuildInternals } from '../internal';
import type { AstroBuildPlugin } from '../plugin';
import type { StaticBuildOptions } from '../types';
import type { BuildInternals } from '../internal.js';
import type { AstroBuildPlugin } from '../plugin.js';
import type { StaticBuildOptions } from '../types.js';
export const MIDDLEWARE_MODULE_ID = '@astro-middleware';

View file

@ -3,8 +3,8 @@ import type { Plugin as VitePlugin } from 'vite';
import { routeIsRedirect } from '../../redirects/index.js';
import { addRollupInput } from '../add-rollup-input.js';
import { type BuildInternals } from '../internal.js';
import type { AstroBuildPlugin } from '../plugin';
import type { StaticBuildOptions } from '../types';
import type { AstroBuildPlugin } from '../plugin.js';
import type { StaticBuildOptions } from '../types.js';
import { MIDDLEWARE_MODULE_ID } from './plugin-middleware.js';
import { RENDERERS_MODULE_ID } from './plugin-renderers.js';
import { ASTRO_PAGE_EXTENSION_POST_PATTERN, getPathFromVirtualModulePageName } from './util.js';

View file

@ -3,7 +3,7 @@ import type { Plugin as VitePlugin } from 'vite';
import { getPrerenderMetadata } from '../../../prerender/metadata.js';
import type { BuildInternals } from '../internal.js';
import type { AstroBuildPlugin } from '../plugin.js';
import type { StaticBuildOptions } from '../types';
import type { StaticBuildOptions } from '../types.js';
import { extendManualChunks } from './util.js';
function vitePluginPrerender(opts: StaticBuildOptions, internals: BuildInternals): VitePlugin {

View file

@ -1,7 +1,7 @@
import type { Plugin as VitePlugin } from 'vite';
import { addRollupInput } from '../add-rollup-input.js';
import type { AstroBuildPlugin } from '../plugin';
import type { StaticBuildOptions } from '../types';
import type { AstroBuildPlugin } from '../plugin.js';
import type { StaticBuildOptions } from '../types.js';
export const RENDERERS_MODULE_ID = '@astro-renderers';
export const RESOLVED_RENDERERS_MODULE_ID = `\0${RENDERERS_MODULE_ID}`;

View file

@ -2,19 +2,19 @@ import glob from 'fast-glob';
import { join } from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import type { Plugin as VitePlugin } from 'vite';
import type { AstroAdapter, AstroConfig } from '../../../@types/astro';
import type { AstroAdapter, AstroConfig } from '../../../@types/astro.js';
import { runHookBuildSsr } from '../../../integrations/index.js';
import { isServerLikeOutput } from '../../../prerender/utils.js';
import { BEFORE_HYDRATION_SCRIPT_ID, PAGE_SCRIPT_ID } from '../../../vite-plugin-scripts/index.js';
import type { SerializedRouteInfo, SerializedSSRManifest } from '../../app/types';
import type { SerializedRouteInfo, SerializedSSRManifest } from '../../app/types.js';
import { joinPaths, prependForwardSlash } from '../../path.js';
import { routeIsRedirect } from '../../redirects/index.js';
import { serializeRouteData } from '../../routing/index.js';
import { addRollupInput } from '../add-rollup-input.js';
import { getOutFile, getOutFolder } from '../common.js';
import { cssOrder, mergeInlineCss, type BuildInternals } from '../internal.js';
import type { AstroBuildPlugin } from '../plugin';
import type { OutputChunk, StaticBuildOptions } from '../types';
import type { AstroBuildPlugin } from '../plugin.js';
import type { OutputChunk, StaticBuildOptions } from '../types.js';
import { ASTRO_PAGE_MODULE_ID } from './plugin-pages.js';
import { RENDERERS_MODULE_ID } from './plugin-renderers.js';
import { getPathFromVirtualModulePageName, getVirtualModulePageNameFromPath } from './util.js';
@ -283,7 +283,7 @@ function generateSSRCode(config: AstroConfig, adapter: AstroAdapter) {
}
contents.push(`import * as adapter from '${adapter.serverEntrypoint}';
import { renderers } from '${RENDERERS_MODULE_ID}';
import { renderers } from '${RENDERERS_MODULE_ID}';
import { deserializeManifest as _deserializeManifest } from 'astro/app';
import { _privateSetManifestDontUseThis } from 'astro:ssr-manifest';
const _manifest = Object.assign(_deserializeManifest('${manifestReplace}'), {

View file

@ -6,7 +6,7 @@ import fs from 'node:fs';
import path, { extname } from 'node:path';
import { fileURLToPath } from 'node:url';
import * as vite from 'vite';
import type { RouteData } from '../../@types/astro';
import type { RouteData } from '../../@types/astro.js';
import {
createBuildInternals,
eachPageData,
@ -30,7 +30,7 @@ import { ASTRO_PAGE_RESOLVED_MODULE_ID } from './plugins/plugin-pages.js';
import { RESOLVED_RENDERERS_MODULE_ID } from './plugins/plugin-renderers.js';
import { RESOLVED_SPLIT_MODULE_ID, SSR_VIRTUAL_MODULE_ID } from './plugins/plugin-ssr.js';
import { ASTRO_PAGE_EXTENSION_POST_PATTERN } from './plugins/util.js';
import type { PageBuildData, StaticBuildOptions } from './types';
import type { PageBuildData, StaticBuildOptions } from './types.js';
import { getTimeStat } from './util.js';
export async function viteBuild(opts: StaticBuildOptions) {

View file

@ -1,4 +1,5 @@
import type { InlineConfig, default as vite } from 'vite';
import type * as vite from 'vite';
import type { InlineConfig } from 'vite';
import type {
AstroConfig,
AstroSettings,
@ -8,9 +9,9 @@ import type {
RouteData,
RuntimeMode,
SSRLoadedRenderer,
} from '../../@types/astro';
import type { LogOptions } from '../logger/core';
import type { RouteCache } from '../render/route-cache';
} from '../../@types/astro.js';
import type { LogOptions } from '../logger/core.js';
import type { RouteCache } from '../render/route-cache.js';
export type ComponentPath = string;
export type ViteID = string;

View file

@ -1,4 +1,4 @@
import type { AstroConfig } from '../../@types/astro';
import type { AstroConfig } from '../../@types/astro.js';
import { compile, type CompileProps, type CompileResult } from './compile.js';
type CompilationCache = Map<string, CompileResult>;

View file

@ -1,6 +1,6 @@
import type { TransformResult } from '@astrojs/compiler';
import type { ResolvedConfig } from 'vite';
import type { AstroConfig } from '../../@types/astro';
import type { AstroConfig } from '../../@types/astro.js';
import { transform } from '@astrojs/compiler';
import { fileURLToPath } from 'node:url';

View file

@ -4,5 +4,5 @@ export {
invalidateCompilation,
isCached,
} from './cache.js';
export type { CompileProps, CompileResult } from './compile';
export type { TransformStyle } from './types';
export type { CompileProps, CompileResult } from './compile.js';
export type { TransformStyle } from './types.js';

View file

@ -1,5 +1,5 @@
import type { Arguments as Flags } from 'yargs-parser';
import type { AstroConfig, AstroUserConfig, CLIFlags } from '../../@types/astro';
import type { AstroConfig, AstroUserConfig, CLIFlags } from '../../@types/astro.js';
import * as colors from 'kleur/colors';
import fs from 'node:fs';

View file

@ -7,6 +7,6 @@ export {
validateConfig,
} from './config.js';
export { mergeConfig } from './merge.js';
export type { AstroConfigSchema } from './schema';
export type { AstroConfigSchema } from './schema.js';
export { createDefaultDevSettings, createSettings } from './settings.js';
export { loadTSConfig, updateTSConfigForFramework } from './tsconfig.js';

View file

@ -1,7 +1,7 @@
import type { RehypePlugin, RemarkPlugin, RemarkRehype } from '@astrojs/markdown-remark';
import { markdownConfigDefaults } from '@astrojs/markdown-remark';
import type { ILanguageRegistration, IThemeRegistration, Theme } from 'shiki';
import type { AstroUserConfig, ViteUserConfig } from '../../@types/astro';
import type { AstroUserConfig, ViteUserConfig } from '../../@types/astro.js';
import type { OutgoingHttpHeaders } from 'node:http';
import path from 'node:path';

View file

@ -1,7 +1,7 @@
import yaml from 'js-yaml';
import path from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
import type { AstroConfig, AstroSettings, AstroUserConfig } from '../../@types/astro';
import type { AstroConfig, AstroSettings, AstroUserConfig } from '../../@types/astro.js';
import { getContentPaths } from '../../content/index.js';
import jsxRenderer from '../../jsx/renderer.js';
import { isServerLikeOutput } from '../../prerender/utils.js';

View file

@ -1,4 +1,4 @@
import type { AstroCookies } from './cookies';
import type { AstroCookies } from './cookies.js';
const astroCookiesSymbol = Symbol.for('astro.cookies');

View file

@ -1,5 +1,5 @@
import type { AstroSettings } from '../@types/astro';
import type { LogOptions } from './logger/core';
import type { AstroSettings } from '../@types/astro.js';
import type { LogOptions } from './logger/core.js';
import nodeFs from 'node:fs';
import { fileURLToPath } from 'node:url';
@ -168,7 +168,7 @@ export async function createVite(
{
// Typings are imported from 'astro' (e.g. import { Type } from 'astro')
find: /^astro$/,
replacement: fileURLToPath(new URL('../@types/astro', import.meta.url)),
replacement: fileURLToPath(new URL('../@types/astro.js', import.meta.url)),
},
],
conditions: ['astro'],

View file

@ -1,6 +1,6 @@
import type * as http from 'node:http';
import type { AddressInfo } from 'node:net';
import type { AstroSettings, AstroUserConfig } from '../../@types/astro';
import type { AstroSettings, AstroUserConfig } from '../../@types/astro.js';
import nodeFs from 'node:fs';
import * as vite from 'vite';

View file

@ -4,7 +4,7 @@ import type { AddressInfo } from 'node:net';
import { performance } from 'perf_hooks';
import type * as vite from 'vite';
import type yargs from 'yargs-parser';
import type { AstroSettings } from '../../@types/astro';
import type { AstroSettings } from '../../@types/astro.js';
import { attachContentServerListeners } from '../../content/index.js';
import { telemetry } from '../../events/index.js';
import { info, warn, type LogOptions } from '../logger/core.js';

View file

@ -1,9 +1,9 @@
import * as vite from 'vite';
import type { AstroSettings } from '../../@types/astro';
import type { AstroSettings } from '../../@types/astro.js';
import { createSettings, openConfig } from '../config/index.js';
import { createSafeError } from '../errors/index.js';
import { info } from '../logger/core.js';
import type { Container, CreateContainerParams } from './container';
import type { Container, CreateContainerParams } from './container.js';
import { createContainer, isStarted, startContainer } from './container.js';
async function createRestartedContainer(

View file

@ -1,4 +1,4 @@
import type { EndpointHandler } from '../../../@types/astro';
import type { EndpointHandler } from '../../../@types/astro.js';
import { createRenderContext, type SSROptions } from '../../render/index.js';
import { callEndpoint } from '../index.js';

View file

@ -5,8 +5,8 @@ import type {
MiddlewareEndpointHandler,
MiddlewareHandler,
Params,
} from '../../@types/astro';
import type { Environment, RenderContext } from '../render/index';
} from '../../@types/astro.js';
import type { Environment, RenderContext } from '../render/index.js';
import { renderEndpoint } from '../../runtime/server/index.js';
import { ASTRO_VERSION } from '../constants.js';

View file

@ -1,4 +1,3 @@
export type { ErrorLocation, ErrorWithMetadata } from './errors';
export { AstroErrorData } from './errors-data.js';
export {
AggregateError,
@ -8,5 +7,6 @@ export {
MarkdownError,
isAstroError,
} from './errors.js';
export type { ErrorLocation, ErrorWithMetadata } from './errors.js';
export { codeFrame } from './printer.js';
export { createSafeError, positionAt } from './utils.js';

View file

@ -1,4 +1,4 @@
import type { AstroErrorPayload } from './dev/vite';
import type { AstroErrorPayload } from './dev/vite.js';
const style = /* css */ `
* {

View file

@ -4,10 +4,10 @@ import type {
EndpointOutput,
MiddlewareHandler,
MiddlewareNext,
} from '../../@types/astro';
} from '../../@types/astro.js';
import { AstroError, AstroErrorData } from '../errors/index.js';
import { warn } from '../logger/core.js';
import type { Environment } from '../render';
import type { Environment } from '../render/index.js';
/**
* Utility function that is in charge of calling the middleware.

View file

@ -1,4 +1,4 @@
import type { MiddlewareResponseHandler, Params } from '../../@types/astro';
import type { MiddlewareResponseHandler, Params } from '../../@types/astro.js';
import { createAPIContext } from '../endpoint/index.js';
import { sequence } from './sequence.js';

View file

@ -1,6 +1,6 @@
import type { AstroSettings } from '../../@types/astro';
import type { AstroSettings } from '../../@types/astro.js';
import { MIDDLEWARE_PATH_SEGMENT_NAME } from '../constants.js';
import type { ModuleLoader } from '../module-loader';
import type { ModuleLoader } from '../module-loader/index.js';
/**
* It accepts a module loader and the astro settings, and it attempts to load the middlewares defined in the configuration.

View file

@ -1,4 +1,4 @@
import type { APIContext, MiddlewareResponseHandler } from '../../@types/astro';
import type { APIContext, MiddlewareResponseHandler } from '../../@types/astro.js';
import { defineMiddleware } from './index.js';
// From SvelteKit: https://github.com/sveltejs/kit/blob/master/packages/kit/src/exports/hooks/sequence.js

View file

@ -1,6 +1,6 @@
import { EventEmitter } from 'node:events';
import type * as fs from 'node:fs';
import type { TypedEventEmitter } from '../../@types/typed-emitter';
import type { TypedEventEmitter } from '../../@types/typed-emitter.js';
// This is a generic interface for a module loader. In the astro cli this is
// fulfilled by Vite, see vite.ts

View file

@ -1,6 +1,6 @@
import { EventEmitter } from 'node:events';
import type * as vite from 'vite';
import type { ModuleLoader, ModuleLoaderEventEmitter } from './loader';
import type { ModuleLoader, ModuleLoaderEventEmitter } from './loader.js';
export function createViteLoader(viteServer: vite.ViteDevServer): ModuleLoader {
const events = new EventEmitter() as ModuleLoaderEventEmitter;

View file

@ -2,9 +2,9 @@ import { cyan } from 'kleur/colors';
import { createRequire } from 'module';
import { pathToFileURL } from 'node:url';
import type { Arguments } from 'yargs-parser';
import type { AstroSettings, PreviewModule, PreviewServer } from '../../@types/astro';
import type { AstroSettings, PreviewModule, PreviewServer } from '../../@types/astro.js';
import { runHookConfigDone, runHookConfigSetup } from '../../integrations/index.js';
import type { LogOptions } from '../logger/core';
import type { LogOptions } from '../logger/core.js';
import { printHelp } from '../messages.js';
import createStaticPreviewServer from './static-preview-server.js';
import { getResolvedHostForHttpServer } from './util.js';

View file

@ -3,8 +3,8 @@ import { fileURLToPath } from 'node:url';
import { performance } from 'perf_hooks';
import enableDestroy from 'server-destroy';
import { preview, type PreviewServer as VitePreviewServer } from 'vite';
import type { AstroSettings } from '../../@types/astro';
import type { LogOptions } from '../logger/core';
import type { AstroSettings } from '../../@types/astro.js';
import type { LogOptions } from '../logger/core.js';
import { error, info } from '../logger/core.js';
import * as msg from '../messages.js';
import { getResolvedHostForHttpServer } from './util.js';

View file

@ -1,5 +1,5 @@
import type { ComponentInstance } from '../../@types/astro';
import type { SinglePageBuiltModule } from '../build/types';
import type { ComponentInstance } from '../../@types/astro.js';
import type { SinglePageBuiltModule } from '../build/types.js';
// A stub of a component instance for a given route
export const RedirectComponentInstance: ComponentInstance = {

View file

@ -1,4 +1,9 @@
import type { Params, RedirectRouteData, RouteData, ValidRedirectStatus } from '../../@types/astro';
import type {
Params,
RedirectRouteData,
RouteData,
ValidRedirectStatus,
} from '../../@types/astro.js';
export function routeIsRedirect(route: RouteData | undefined): route is RedirectRouteData {
return route?.type === 'redirect';

View file

@ -5,9 +5,9 @@ import type {
RouteData,
SSRElement,
SSRResult,
} from '../../@types/astro';
} from '../../@types/astro.js';
import { AstroError, AstroErrorData } from '../errors/index.js';
import type { Environment } from './environment';
import type { Environment } from './environment.js';
import { getParamsAndProps } from './params-and-props.js';
const clientLocalsSymbol = Symbol.for('astro.locals');

View file

@ -5,7 +5,7 @@ import type {
MiddlewareHandler,
MiddlewareResponseHandler,
RouteType,
} from '../../@types/astro';
} from '../../@types/astro.js';
import { renderPage as runtimeRenderPage } from '../../runtime/server/index.js';
import { attachToResponse } from '../cookies/index.js';
import { callEndpoint, createAPIContext, type EndpointCallResult } from '../endpoint/index.js';

View file

@ -1,7 +1,7 @@
import type { MarkdownRenderingOptions } from '@astrojs/markdown-remark';
import type { AstroSettings, RuntimeMode, SSRLoadedRenderer } from '../../@types/astro';
import type { AstroSettings, RuntimeMode, SSRLoadedRenderer } from '../../@types/astro.js';
import type { LogOptions } from '../logger/core.js';
import type { ModuleLoader } from '../module-loader';
import type { ModuleLoader } from '../module-loader/index.js';
import type { RouteCache } from './route-cache.js';
/**

View file

@ -1,11 +1,11 @@
import type { AstroMiddlewareInstance, ComponentInstance, RouteData } from '../../@types/astro';
import type { DevelopmentEnvironment } from './environment';
import type { AstroMiddlewareInstance, ComponentInstance, RouteData } from '../../@types/astro.js';
import type { DevelopmentEnvironment } from './environment.js';
export { createRenderContext } from './context.js';
export type { RenderContext } from './context.js';
export { tryRenderRoute } from './core.js';
export type { Environment } from './environment';
export { createEnvironment } from './environment.js';
export type { Environment } from './environment.js';
export { getParamsAndProps } from './params-and-props.js';
export { loadRenderer, loadRenderers } from './renderer.js';
export type { DevelopmentEnvironment };

View file

@ -5,7 +5,7 @@ import type {
Params,
Props,
RouteData,
} from '../../@types/astro';
} from '../../@types/astro.js';
import { AstroError, AstroErrorData } from '../errors/index.js';
export function generatePaginateFunction(routeMatch: RouteData): PaginateFunction {

View file

@ -1,4 +1,4 @@
import type { ComponentInstance, Params, Props, RouteData } from '../../@types/astro';
import type { ComponentInstance, Params, Props, RouteData } from '../../@types/astro.js';
import { AstroError, AstroErrorData } from '../errors/index.js';
import type { LogOptions } from '../logger/core.js';
import { getParams } from '../routing/params.js';

View file

@ -1,4 +1,4 @@
import type { AstroRenderer, AstroSettings, SSRLoadedRenderer } from '../../@types/astro';
import type { AstroRenderer, AstroSettings, SSRLoadedRenderer } from '../../@types/astro.js';
import type { ModuleLoader } from '../module-loader/index.js';
export async function loadRenderers(

Some files were not shown because too many files have changed in this diff Show more