nit: use node:
prefix everywhere (#7692)
* nit: use `node:` prefix everywhere * nit: fs/promises too * test: workaround issue in node builtin detection
This commit is contained in:
parent
cc0f81c040
commit
f14e48098a
150 changed files with 283 additions and 286 deletions
8
.github/scripts/bundle-size.mjs
vendored
8
.github/scripts/bundle-size.mjs
vendored
|
@ -1,5 +1,5 @@
|
|||
import { build } from 'esbuild';
|
||||
import { existsSync } from 'fs';
|
||||
import { existsSync } from 'node:fs';
|
||||
|
||||
const CLIENT_RUNTIME_PATH = 'packages/astro/src/runtime/client/';
|
||||
|
||||
|
@ -27,13 +27,13 @@ export default async function checkBundleSize({ github, context }) {
|
|||
return file.filename.startsWith(CLIENT_RUNTIME_PATH) && file.status !== 'removed'
|
||||
});
|
||||
if (clientRuntimeFiles.length === 0) return;
|
||||
|
||||
|
||||
const table = [
|
||||
'| File | Old Size | New Size | Change |',
|
||||
'| ---- | -------- | -------- | ------ |',
|
||||
];
|
||||
const output = await bundle(clientRuntimeFiles);
|
||||
|
||||
|
||||
for (let [filename, { oldSize, newSize, sourceFile }] of Object.entries(output)) {
|
||||
filename = ['idle', 'load', 'media', 'only', 'visible'].includes(filename) ? `client:${filename}` : filename;
|
||||
const prefix = (newSize - oldSize) === 0 ? '' : (newSize - oldSize) > 0 ? '+ ' : '- ';
|
||||
|
@ -60,7 +60,7 @@ ${table.join('\n')}`,
|
|||
}
|
||||
|
||||
async function bundle(files) {
|
||||
|
||||
|
||||
const { metafile } = await build({
|
||||
entryPoints: [...files.map(({ filename }) => filename), ...files.map(({ filename }) => `main/${filename}`).filter(f => existsSync(f))],
|
||||
bundle: true,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { fileURLToPath } from 'url';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { execaCommand } from 'execa';
|
||||
import { markdownTable } from 'markdown-table';
|
||||
import { astroBin, calculateStat } from './_util.js';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import fs from 'fs/promises';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { execaCommand } from 'execa';
|
||||
import { markdownTable } from 'markdown-table';
|
||||
import fs from 'node:fs/promises';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { astroBin } from './_util.js';
|
||||
|
||||
/** @typedef {Record<string, import('../../packages/astro/src/core/config/timer').Stat>} AstroTimerStat */
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import fs from 'fs/promises';
|
||||
import http from 'http';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { execaCommand } from 'execa';
|
||||
import { waitUntilBusy } from 'port-authority';
|
||||
import { markdownTable } from 'markdown-table';
|
||||
import { renderFiles } from '../make-project/render-default.js';
|
||||
import fs from 'node:fs/promises';
|
||||
import http from 'node:http';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { waitUntilBusy } from 'port-authority';
|
||||
import { calculateStat } from '../make-project/_util.js';
|
||||
import { renderFiles } from '../make-project/render-default.js';
|
||||
import { astroBin } from './_util.js';
|
||||
|
||||
const port = 4322;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import fs from 'fs/promises';
|
||||
import { fileURLToPath } from 'url';
|
||||
import autocannon from 'autocannon';
|
||||
import { execaCommand } from 'execa';
|
||||
import { waitUntilBusy } from 'port-authority';
|
||||
import { markdownTable } from 'markdown-table';
|
||||
import fs from 'node:fs/promises';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { waitUntilBusy } from 'port-authority';
|
||||
import pb from 'pretty-bytes';
|
||||
import { astroBin } from './_util.js';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import fs from 'fs/promises';
|
||||
import path from 'path';
|
||||
import { pathToFileURL } from 'url';
|
||||
import mri from 'mri';
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { pathToFileURL } from 'node:url';
|
||||
|
||||
const args = mri(process.argv.slice(2));
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import fs from 'fs/promises';
|
||||
import fs from 'node:fs/promises';
|
||||
import { loremIpsum } from './_util.js';
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import fs from 'fs/promises';
|
||||
import fs from 'node:fs/promises';
|
||||
import { loremIpsumHtml, loremIpsumMd } from './_util.js';
|
||||
|
||||
// Map of files to be generated and tested for rendering.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import fs from 'fs/promises';
|
||||
import fs from 'node:fs/promises';
|
||||
import { loremIpsum } from './_util.js';
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { CreatePreviewServer } from 'astro';
|
||||
import { createServer } from 'http';
|
||||
import { createServer } from 'node:http';
|
||||
import enableDestroy from 'server-destroy';
|
||||
|
||||
const preview: CreatePreviewServer = async function ({ serverEntrypoint, host, port }) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { polyfill } from '@astrojs/webapi';
|
||||
import type { SSRManifest } from 'astro';
|
||||
import { NodeApp } from 'astro/app/node';
|
||||
import type { IncomingMessage, ServerResponse } from 'http';
|
||||
import type { IncomingMessage, ServerResponse } from 'node:http';
|
||||
|
||||
polyfill(globalThis, {
|
||||
exclude: 'window document',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { defineConfig } from 'astro/config';
|
||||
import react from "@astrojs/react";
|
||||
import { fileURLToPath } from 'url';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
export default defineConfig({
|
||||
integrations: [astroClientClickDirective(), astroClientPasswordDirective(), react()],
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { defineConfig } from 'astro/config';
|
||||
import tailwind from '@astrojs/tailwind';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const path = require('path');
|
||||
const path = require('node:path');
|
||||
|
||||
module.exports = {
|
||||
content: [path.join(__dirname, 'src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}')],
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import fs from 'fs/promises';
|
||||
import path from 'path';
|
||||
import { test as testBase, expect } from '@playwright/test';
|
||||
import { expect, test as testBase } from '@playwright/test';
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { loadFixture as baseLoadFixture } from '../test/test-utils.js';
|
||||
|
||||
export const isWindows = process.platform === 'win32';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* eslint-disable no-console */
|
||||
|
||||
import { fileURLToPath } from 'url';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { loadFixture } from '../test/test-utils.js';
|
||||
import { generatePosts } from './scripts/generate-posts.mjs';
|
||||
import yargs from 'yargs-parser';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
const NUM_POSTS = 10;
|
||||
const POSTS_DIR = './src/content/posts.generated';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import fs from 'fs';
|
||||
import fs from 'node:fs';
|
||||
|
||||
const dir = await fs.promises.readdir('packages/astro/node_modules/shiki/languages/');
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import fs from 'fs';
|
||||
import fs from 'node:fs';
|
||||
|
||||
const dir = await fs.promises.readdir('packages/astro/node_modules/shiki/themes/');
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ import type {
|
|||
ShikiConfig,
|
||||
} from '@astrojs/markdown-remark';
|
||||
import type * as babel from '@babel/core';
|
||||
import type { OutgoingHttpHeaders } from 'http';
|
||||
import type { AddressInfo } from 'net';
|
||||
import type { OutgoingHttpHeaders } from 'node:http';
|
||||
import type { AddressInfo } from 'node:net';
|
||||
import type * as rollup from 'rollup';
|
||||
import type { TsConfigJson } from 'tsconfig-resolver';
|
||||
import type * as vite from 'vite';
|
||||
|
|
|
@ -41,13 +41,13 @@ var Module = (function () {
|
|||
var nodePath
|
||||
if (ENVIRONMENT_IS_NODE) {
|
||||
if (ENVIRONMENT_IS_WORKER) {
|
||||
scriptDirectory = require('path').dirname(scriptDirectory) + '/'
|
||||
scriptDirectory = require('node:path').dirname(scriptDirectory) + '/'
|
||||
} else {
|
||||
scriptDirectory = dirname(getModuleURL(import.meta.url)) + '/'
|
||||
}
|
||||
read_ = function shell_read(filename, binary) {
|
||||
if (!nodeFS) nodeFS = require('fs')
|
||||
if (!nodePath) nodePath = require('path')
|
||||
if (!nodeFS) nodeFS = require('node:fs')
|
||||
if (!nodePath) nodePath = require('node:path')
|
||||
filename = nodePath['normalize'](filename)
|
||||
return nodeFS['readFileSync'](filename, binary ? null : 'utf8')
|
||||
}
|
||||
|
|
|
@ -41,13 +41,13 @@ var Module = (function () {
|
|||
var nodePath
|
||||
if (ENVIRONMENT_IS_NODE) {
|
||||
if (ENVIRONMENT_IS_WORKER) {
|
||||
scriptDirectory = require('path').dirname(scriptDirectory) + '/'
|
||||
scriptDirectory = require('node:path').dirname(scriptDirectory) + '/'
|
||||
} else {
|
||||
scriptDirectory = dirname(getModuleURL(import.meta.url)) + '/'
|
||||
}
|
||||
read_ = function shell_read(filename, binary) {
|
||||
if (!nodeFS) nodeFS = require('fs')
|
||||
if (!nodePath) nodePath = require('path')
|
||||
if (!nodeFS) nodeFS = require('node:fs')
|
||||
if (!nodePath) nodePath = require('node:path')
|
||||
filename = nodePath['normalize'](filename)
|
||||
return nodeFS['readFileSync'](filename, binary ? null : 'utf8')
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { cpus } from 'node:os';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { isMainThread } from 'node:worker_threads';
|
||||
import { cpus } from 'os';
|
||||
import { fileURLToPath } from 'url';
|
||||
import type { ImageOutputFormat } from '../../../types.js';
|
||||
import { getModuleURL } from './emscripten-utils.js';
|
||||
import type { Operation } from './image.js';
|
||||
|
|
|
@ -41,13 +41,13 @@ var Module = (function () {
|
|||
var nodePath
|
||||
if (ENVIRONMENT_IS_NODE) {
|
||||
if (ENVIRONMENT_IS_WORKER) {
|
||||
scriptDirectory = require('path').dirname(scriptDirectory) + '/'
|
||||
scriptDirectory = require('node:path').dirname(scriptDirectory) + '/'
|
||||
} else {
|
||||
scriptDirectory = dirname(getModuleURL(import.meta.url)) + '/'
|
||||
}
|
||||
read_ = function shell_read(filename, binary) {
|
||||
if (!nodeFS) nodeFS = require('fs')
|
||||
if (!nodePath) nodePath = require('path')
|
||||
if (!nodeFS) nodeFS = require('node:fs')
|
||||
if (!nodePath) nodePath = require('node:path')
|
||||
filename = nodePath['normalize'](filename)
|
||||
return nodeFS['readFileSync'](filename, binary ? null : 'utf8')
|
||||
}
|
||||
|
|
|
@ -41,13 +41,13 @@ var Module = (function () {
|
|||
var nodePath
|
||||
if (ENVIRONMENT_IS_NODE) {
|
||||
if (ENVIRONMENT_IS_WORKER) {
|
||||
scriptDirectory = require('path').dirname(scriptDirectory) + '/'
|
||||
scriptDirectory = require('node:path').dirname(scriptDirectory) + '/'
|
||||
} else {
|
||||
scriptDirectory = dirname(getModuleURL(import.meta.url)) + '/'
|
||||
}
|
||||
read_ = function shell_read(filename, binary) {
|
||||
if (!nodeFS) nodeFS = require('fs')
|
||||
if (!nodePath) nodePath = require('path')
|
||||
if (!nodeFS) nodeFS = require('node:fs')
|
||||
if (!nodePath) nodePath = require('node:path')
|
||||
filename = nodePath['normalize'](filename)
|
||||
return nodeFS['readFileSync'](filename, binary ? null : 'utf8')
|
||||
}
|
||||
|
|
|
@ -41,13 +41,13 @@ var Module = (function () {
|
|||
var nodePath
|
||||
if (ENVIRONMENT_IS_NODE) {
|
||||
if (ENVIRONMENT_IS_WORKER) {
|
||||
scriptDirectory = require('path').dirname(scriptDirectory) + '/'
|
||||
scriptDirectory = require('node:path').dirname(scriptDirectory) + '/'
|
||||
} else {
|
||||
scriptDirectory = dirname(getModuleURL(import.meta.url)) + '/'
|
||||
}
|
||||
read_ = function shell_read(filename, binary) {
|
||||
if (!nodeFS) nodeFS = require('fs')
|
||||
if (!nodePath) nodePath = require('path')
|
||||
if (!nodeFS) nodeFS = require('node:fs')
|
||||
if (!nodePath) nodePath = require('node:path')
|
||||
filename = nodePath['normalize'](filename)
|
||||
return nodeFS['readFileSync'](filename, binary ? null : 'utf8')
|
||||
}
|
||||
|
|
|
@ -41,13 +41,13 @@ var Module = (function () {
|
|||
var nodePath
|
||||
if (ENVIRONMENT_IS_NODE) {
|
||||
if (ENVIRONMENT_IS_WORKER) {
|
||||
scriptDirectory = require('path').dirname(scriptDirectory) + '/'
|
||||
scriptDirectory = require('node:path').dirname(scriptDirectory) + '/'
|
||||
} else {
|
||||
scriptDirectory = dirname(getModuleURL(import.meta.url)) + '/'
|
||||
}
|
||||
read_ = function shell_read(filename, binary) {
|
||||
if (!nodeFS) nodeFS = require('fs')
|
||||
if (!nodePath) nodePath = require('path')
|
||||
if (!nodeFS) nodeFS = require('node:fs')
|
||||
if (!nodePath) nodePath = require('node:path')
|
||||
filename = nodePath['normalize'](filename)
|
||||
return nodeFS['readFileSync'](filename, binary ? null : 'utf8')
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { basename, extname } from 'path';
|
||||
import { basename, extname } from 'node:path';
|
||||
import { removeQueryString } from '../../core/path.js';
|
||||
import { shorthash } from '../../runtime/server/shorthash.js';
|
||||
import { isESMImportedImage } from '../internal.js';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import * as fs from "node:fs";
|
||||
import * as path from "node:path";
|
||||
import Queue from "../queue/queue.js";
|
||||
import { detector } from "./detector.js";
|
||||
import { typeHandlers, type imageType } from "./types.js";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// based on http://www.compix.com/fileformattif.htm
|
||||
// TO-DO: support big-endian as well
|
||||
import * as fs from 'fs'
|
||||
import * as fs from 'node:fs'
|
||||
import { readUInt } from '../readUInt.js'
|
||||
import type { IImage } from './interface'
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import boxen from 'boxen';
|
||||
import { diffWords } from 'diff';
|
||||
import { execa } from 'execa';
|
||||
import fsMod, { existsSync, promises as fs } from 'fs';
|
||||
import { bold, cyan, dim, green, magenta, red, yellow } from 'kleur/colors';
|
||||
import fsMod, { existsSync, promises as fs } from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
import ora from 'ora';
|
||||
import path from 'path';
|
||||
import preferredPM from 'preferred-pm';
|
||||
import prompts from 'prompts';
|
||||
import { fileURLToPath, pathToFileURL } from 'url';
|
||||
import type yargs from 'yargs-parser';
|
||||
import { loadTSConfig, resolveConfigPath } from '../../core/config/index.js';
|
||||
import {
|
||||
|
|
|
@ -5,12 +5,12 @@ import {
|
|||
} from '@astrojs/language-server';
|
||||
import type { FSWatcher } from 'chokidar';
|
||||
import glob from 'fast-glob';
|
||||
import fs from 'fs';
|
||||
import { bold, dim, red, yellow } from 'kleur/colors';
|
||||
import { createRequire } from 'module';
|
||||
import fs from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
import ora from 'ora';
|
||||
import { fileURLToPath, pathToFileURL } from 'url';
|
||||
import type { Arguments as Flags } from 'yargs-parser';
|
||||
import type { AstroSettings } from '../../@types/astro';
|
||||
import type { LogOptions } from '../../core/logger/core.js';
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
yellow,
|
||||
} from 'kleur/colors';
|
||||
import stringWidth from 'string-width';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
export function printDiagnostic(filePath: string, text: string, diag: Diagnostic): string {
|
||||
let result = [];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import fs from 'fs';
|
||||
import fs from 'node:fs';
|
||||
import type yargs from 'yargs-parser';
|
||||
import { resolveConfigPath, resolveFlags } from '../../core/config/index.js';
|
||||
import devServer from '../../core/dev/index.js';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* eslint-disable no-console */
|
||||
import fs from 'fs';
|
||||
import * as colors from 'kleur/colors';
|
||||
import fs from 'node:fs';
|
||||
import type { Arguments as Flags } from 'yargs-parser';
|
||||
import { ZodError } from 'zod';
|
||||
import { createSettings, openConfig, resolveConfigPath } from '../core/config/index.js';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import fs from 'fs';
|
||||
import fs from 'node:fs';
|
||||
import type yargs from 'yargs-parser';
|
||||
import type { LogOptions } from '../../core/logger/core.js';
|
||||
import { syncCli } from '../../core/sync/index.js';
|
||||
|
|
|
@ -22,7 +22,7 @@ export function getViteConfig(inlineConfig: UserConfig) {
|
|||
{ runHookConfigSetup, runHookConfigDone },
|
||||
{ astroContentListenPlugin },
|
||||
] = await Promise.all([
|
||||
import('fs'),
|
||||
import('node:fs'),
|
||||
import('vite'),
|
||||
import('../core/logger/node.js'),
|
||||
import('../core/config/index.js'),
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as devalue from 'devalue';
|
|||
import type fsMod from 'node:fs';
|
||||
import { extname } from 'node:path';
|
||||
import type { PluginContext } from 'rollup';
|
||||
import { pathToFileURL } from 'url';
|
||||
import { pathToFileURL } from 'node:url';
|
||||
import type { Plugin } from 'vite';
|
||||
import type {
|
||||
AstroConfig,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import type { RouteData } from '../../@types/astro';
|
||||
import type { SerializedSSRManifest, SSRManifest } from './types';
|
||||
|
||||
import * as fs from 'fs';
|
||||
import { IncomingMessage } from 'http';
|
||||
import { TLSSocket } from 'tls';
|
||||
import * as fs from 'node:fs';
|
||||
import { IncomingMessage } from 'node:http';
|
||||
import { TLSSocket } from 'node:tls';
|
||||
import { deserializeManifest } from './common.js';
|
||||
import { App, type MatchOptions } from './index.js';
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import npath from 'path';
|
||||
import { fileURLToPath, pathToFileURL } from 'url';
|
||||
import npath from 'node:path';
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
import type { AstroConfig, RouteType } from '../../@types/astro';
|
||||
import { appendForwardSlash } from '../../core/path.js';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import type { GetModuleInfo } from 'rollup';
|
||||
|
||||
import crypto from 'crypto';
|
||||
import npath from 'path';
|
||||
import crypto from 'node:crypto';
|
||||
import npath from 'node:path';
|
||||
import type { AstroSettings } from '../../@types/astro';
|
||||
import { viteID } from '../util.js';
|
||||
import { getTopLevelPages } from './graph.js';
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import fs from 'fs';
|
||||
import * as colors from 'kleur/colors';
|
||||
import { bgGreen, black, cyan, dim, green, magenta } from 'kleur/colors';
|
||||
import fs from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import type { OutputAsset, OutputChunk } from 'rollup';
|
||||
import { fileURLToPath } from 'url';
|
||||
import type {
|
||||
AstroConfig,
|
||||
AstroSettings,
|
||||
|
@ -41,8 +41,8 @@ import { callEndpoint, throwIfRedirectNotAllowed } from '../endpoint/index.js';
|
|||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||
import { debug, info } from '../logger/core.js';
|
||||
import {
|
||||
getRedirectLocationOrThrow,
|
||||
RedirectSinglePageBuiltModule,
|
||||
getRedirectLocationOrThrow,
|
||||
routeIsRedirect,
|
||||
} from '../redirects/index.js';
|
||||
import { createEnvironment, createRenderContext, tryRenderPage } from '../render/index.js';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import fs from 'fs';
|
||||
import * as colors from 'kleur/colors';
|
||||
import { performance } from 'perf_hooks';
|
||||
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';
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import { teardown } from '@astrojs/compiler';
|
||||
import * as eslexer from 'es-module-lexer';
|
||||
import glob from 'fast-glob';
|
||||
import fs from 'fs';
|
||||
import { bgGreen, bgMagenta, black, dim } from 'kleur/colors';
|
||||
import { extname } from 'node:path';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
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 {
|
||||
|
|
|
@ -3,7 +3,7 @@ import type { ResolvedConfig } from 'vite';
|
|||
import type { AstroConfig } from '../../@types/astro';
|
||||
|
||||
import { transform } from '@astrojs/compiler';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { normalizePath } from 'vite';
|
||||
import { AggregateError, AstroError, CompilerError } from '../errors/errors.js';
|
||||
import { AstroErrorData } from '../errors/index.js';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { TransformOptions } from '@astrojs/compiler';
|
||||
import fs from 'fs';
|
||||
import fs from 'node:fs';
|
||||
import { preprocessCSS, type ResolvedConfig } from 'vite';
|
||||
import { AstroErrorData, CSSError, positionAt } from '../errors/index.js';
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import type { Arguments as Flags } from 'yargs-parser';
|
||||
import type { AstroConfig, AstroUserConfig, CLIFlags } from '../../@types/astro';
|
||||
|
||||
import fs from 'fs';
|
||||
import * as colors from 'kleur/colors';
|
||||
import path from 'path';
|
||||
import { fileURLToPath, pathToFileURL } from 'url';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||
import { mergeConfig } from './merge.js';
|
||||
import { createRelativeSchema } from './schema.js';
|
||||
|
|
|
@ -3,7 +3,7 @@ import { markdownConfigDefaults } from '@astrojs/markdown-remark';
|
|||
import type { ILanguageRegistration, IThemeRegistration, Theme } from 'shiki';
|
||||
import type { AstroUserConfig, ViteUserConfig } from '../../@types/astro';
|
||||
|
||||
import type { OutgoingHttpHeaders } from 'http';
|
||||
import type { OutgoingHttpHeaders } from 'node:http';
|
||||
import { BUNDLED_THEMES } from 'shiki';
|
||||
import { z } from 'zod';
|
||||
import { appendForwardSlash, prependForwardSlash, trimSlashes } from '../path.js';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import yaml from 'js-yaml';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath, pathToFileURL } from 'url';
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
import type { AstroConfig, AstroSettings, AstroUserConfig } from '../../@types/astro';
|
||||
import { getContentPaths } from '../../content/index.js';
|
||||
import jsxRenderer from '../../jsx/renderer.js';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import fs from 'fs';
|
||||
import fs from 'node:fs';
|
||||
|
||||
// Type used by `bench-memory.js`
|
||||
export interface Stat {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { deepmerge } from 'deepmerge-ts';
|
||||
import { existsSync } from 'fs';
|
||||
import { join } from 'path';
|
||||
import { existsSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import * as tsr from 'tsconfig-resolver';
|
||||
|
||||
export const defaultTSConfig: tsr.TsConfigJson = { extends: 'astro/tsconfigs/base' };
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type fsType from 'fs';
|
||||
import { pathToFileURL } from 'url';
|
||||
import type fsType from 'node:fs';
|
||||
import { pathToFileURL } from 'node:url';
|
||||
import { createServer, type ViteDevServer } from 'vite';
|
||||
import loadFallbackPlugin from '../../vite-plugin-load-fallback/index.js';
|
||||
import { debug } from '../logger/core.js';
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import type { AstroSettings } from '../@types/astro';
|
||||
import type { LogOptions } from './logger/core';
|
||||
|
||||
import nodeFs from 'fs';
|
||||
import { fileURLToPath } from 'url';
|
||||
import nodeFs from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import * as vite from 'vite';
|
||||
import { crawlFrameworkPkgs } from 'vitefu';
|
||||
import astroAssetsPlugin from '../assets/vite-plugin-assets.js';
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import type * as http from 'http';
|
||||
import type { AddressInfo } from 'net';
|
||||
import type * as http from 'node:http';
|
||||
import type { AddressInfo } from 'node:net';
|
||||
import type { AstroSettings, AstroUserConfig } from '../../@types/astro';
|
||||
|
||||
import nodeFs from 'fs';
|
||||
import nodeFs from 'node:fs';
|
||||
import * as vite from 'vite';
|
||||
import {
|
||||
runHookConfigDone,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type http from 'http';
|
||||
import { cyan } from 'kleur/colors';
|
||||
import type { AddressInfo } from 'net';
|
||||
import type http from 'node:http';
|
||||
import type { AddressInfo } from 'node:net';
|
||||
import { performance } from 'perf_hooks';
|
||||
import type * as vite from 'vite';
|
||||
import type yargs from 'yargs-parser';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import * as fs from 'fs';
|
||||
import * as fs from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { getHighlighter } from 'shiki';
|
||||
import { fileURLToPath } from 'url';
|
||||
import type { ErrorPayload } from 'vite';
|
||||
import type { ModuleLoader } from '../../module-loader/index.js';
|
||||
import { AstroErrorData } from '../errors-data.js';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { appendForwardSlash } from '../path.js';
|
||||
|
||||
const isWindows = process.platform === 'win32';
|
||||
|
@ -63,7 +63,7 @@ export function emptyDir(_dir: URL, skip?: Set<string>): void {
|
|||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import debugPackage from 'debug';
|
||||
import { bold, cyan, dim, red, reset, yellow } from 'kleur/colors';
|
||||
import * as readline from 'readline';
|
||||
import { Writable } from 'stream';
|
||||
import * as readline from 'node:readline';
|
||||
import { Writable } from 'node:stream';
|
||||
import stringWidth from 'string-width';
|
||||
import { dateTimeFormat, error, info, warn } from './core.js';
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { EventEmitter } from 'events';
|
||||
import type * as fs from 'fs';
|
||||
import { EventEmitter } from 'node:events';
|
||||
import type * as fs from 'node:fs';
|
||||
import type { TypedEventEmitter } from '../../@types/typed-emitter';
|
||||
|
||||
// This is a generic interface for a module loader. In the astro cli this is
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { EventEmitter } from 'events';
|
||||
import { EventEmitter } from 'node:events';
|
||||
import type * as vite from 'vite';
|
||||
import type { ModuleLoader, ModuleLoaderEventEmitter } from './loader';
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { cyan } from 'kleur/colors';
|
||||
import { createRequire } from 'module';
|
||||
import { pathToFileURL } from 'url';
|
||||
import { pathToFileURL } from 'node:url';
|
||||
import type { Arguments } from 'yargs-parser';
|
||||
import type { AstroSettings, PreviewModule, PreviewServer } from '../../@types/astro';
|
||||
import { runHookConfigDone, runHookConfigSetup } from '../../integrations/index.js';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import type http from 'http';
|
||||
import type http from 'node:http';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { performance } from 'perf_hooks';
|
||||
import enableDestroy from 'server-destroy';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { preview, type PreviewServer as VitePreviewServer } from 'vite';
|
||||
import type { AstroSettings } from '../../@types/astro';
|
||||
import type { LogOptions } from '../logger/core';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import fs from 'fs';
|
||||
import { fileURLToPath } from 'url';
|
||||
import fs from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import type { Plugin } from 'vite';
|
||||
import type { AstroSettings } from '../../@types/astro.js';
|
||||
import { notFoundTemplate, subpathNotUsedTemplate } from '../../template/4xx.js';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { ModuleLoader, ModuleNode } from '../../module-loader/index';
|
||||
|
||||
import npath from 'path';
|
||||
import npath from 'node:path';
|
||||
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from '../../constants.js';
|
||||
import { unwrapId } from '../../util.js';
|
||||
import { isCSSRequest } from './util.js';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { IncomingHttpHeaders } from 'http';
|
||||
import type { IncomingHttpHeaders } from 'node:http';
|
||||
import type { LogOptions } from './logger/core';
|
||||
import { warn } from './logger/core.js';
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@ import type {
|
|||
} from '../../../@types/astro';
|
||||
import type { LogOptions } from '../../logger/core';
|
||||
|
||||
import nodeFs from 'fs';
|
||||
import { createRequire } from 'module';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import nodeFs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { getPrerenderDefault } from '../../../prerender/utils.js';
|
||||
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from '../../constants.js';
|
||||
import { warn } from '../../logger/core.js';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { normalizePath } from 'vite';
|
||||
import type { AstroConfig, AstroSettings, RouteType } from '../@types/astro';
|
||||
import { isServerLikeOutput } from '../prerender/utils.js';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { bold } from 'kleur/colors';
|
||||
import type { AddressInfo } from 'net';
|
||||
import fs from 'node:fs';
|
||||
import type { AddressInfo } from 'node:net';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import type { InlineConfig, ViteDevServer } from 'vite';
|
||||
import type {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import type * as vite from 'vite';
|
||||
import type { AstroSettings } from '../@types/astro';
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as fs from 'node:fs';
|
||||
import { warn, type LogOptions } from '../core/logger/core.js';
|
||||
import notFoundTemplate, { subpathNotUsedTemplate } from '../template/4xx.js';
|
||||
import { log404 } from './common.js';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type fs from 'fs';
|
||||
import type fs from 'node:fs';
|
||||
import type * as vite from 'vite';
|
||||
import type { AstroSettings, ManifestData, SSRManifest } from '../@types/astro';
|
||||
import { patchOverlay } from '../core/errors/overlay.js';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type http from 'http';
|
||||
import type http from 'node:http';
|
||||
import type { ManifestData, SSRManifest } from '../@types/astro';
|
||||
import type { DevelopmentEnvironment } from '../core/render/dev/index';
|
||||
import type { DevServerController } from './controller';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type http from 'http';
|
||||
import type http from 'node:http';
|
||||
import type { ErrorWithMetadata } from '../core/errors/index.js';
|
||||
import type { ModuleLoader } from '../core/module-loader/index';
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type http from 'http';
|
||||
import mime from 'mime';
|
||||
import type http from 'node:http';
|
||||
import type { ComponentInstance, ManifestData, RouteData, SSRManifest } from '../@types/astro';
|
||||
import { attachToResponse } from '../core/cookies/index.js';
|
||||
import { call as callEndpoint } from '../core/endpoint/dev/index.js';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
import { normalizePath, type Plugin as VitePlugin, type ResolvedConfig } from 'vite';
|
||||
import type { AstroSettings } from '../@types/astro';
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import MagicString from 'magic-string';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import type * as vite from 'vite';
|
||||
import { loadEnv } from 'vite';
|
||||
import type { AstroConfig, AstroSettings } from '../@types/astro';
|
||||
|
|
|
@ -11,7 +11,7 @@ import type { PluginMetadata } from '../vite-plugin-astro/types';
|
|||
|
||||
import babel from '@babel/core';
|
||||
import * as colors from 'kleur/colors';
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
import { CONTENT_FLAG, PROPAGATED_ASSET_FLAG } from '../content/index.js';
|
||||
import { astroEntryPrefix } from '../core/build/plugins/plugin-component-entry.js';
|
||||
import { error } from '../core/logger/core.js';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import nodeFs from 'fs';
|
||||
import npath from 'path';
|
||||
import nodeFs from 'node:fs';
|
||||
import npath from 'node:path';
|
||||
import type * as vite from 'vite';
|
||||
import { slash } from '../core/path.js';
|
||||
|
||||
|
@ -15,7 +15,7 @@ export default function loadFallbackPlugin({
|
|||
root,
|
||||
}: LoadFallbackPluginParams): vite.Plugin[] | false {
|
||||
// Only add this plugin if a custom fs implementation is provided.
|
||||
// Also check for `fs.default` because `import * as fs from 'fs'` will
|
||||
// Also check for `fs.default` because `import * as fs from 'node:fs'` will
|
||||
// export as so, which only it's `.default` would === `nodeFs`.
|
||||
// @ts-expect-error check default
|
||||
if (!fs || fs === nodeFs || fs.default === nodeFs) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import ancestor from 'common-ancestor-path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import type { AstroConfig } from '../@types/astro';
|
||||
import {
|
||||
appendExtension,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { expect } from 'chai';
|
||||
import os from 'node:os';
|
||||
import { loadFixture } from './test-utils.js';
|
||||
import os from 'os';
|
||||
|
||||
// TODO: fix these tests on macOS
|
||||
const isMacOS = os.platform() === 'darwin';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { expect } from 'chai';
|
||||
import * as fs from 'node:fs';
|
||||
import { loadFixture } from './test-utils.js';
|
||||
import * as fs from 'fs';
|
||||
|
||||
describe('outDir set to project root', async () => {
|
||||
/** @type {import('./test-utils').Fixture} */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { defineConfig } from 'astro/config';
|
||||
import tailwind from '@astrojs/tailwind';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
export default defineConfig({
|
||||
integrations: [
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { defineConfig } from 'astro/config';
|
||||
import tailwind from '@astrojs/tailwind';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { defineConfig } from 'astro/config';
|
||||
import tailwind from '@astrojs/tailwind';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { defineConfig } from 'astro/config';
|
||||
import tailwind from '@astrojs/tailwind';
|
||||
import mdx from '@astrojs/mdx';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const path = require('path');
|
||||
const path = require('node:path');
|
||||
|
||||
module.exports = {
|
||||
content: [path.join(__dirname, 'src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}')],
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// TODO: unskip this test
|
||||
// import { expect } from 'chai';
|
||||
// import { fileURLToPath } from 'url';
|
||||
// import { fileURLToPath } from 'node:url';
|
||||
// import { createRouteManifest } from '../dist/core/routing/index.js';
|
||||
// import { validateConfig } from '../dist/core/config.js';
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { expect } from 'chai';
|
||||
import net from 'node:net';
|
||||
import { File, FormData } from 'undici';
|
||||
import testAdapter from './test-adapter.js';
|
||||
import { loadFixture } from './test-utils.js';
|
||||
import net from 'net';
|
||||
|
||||
describe('API routes in SSR', () => {
|
||||
/** @type {import('./test-utils').Fixture} */
|
||||
|
|
|
@ -50,12 +50,12 @@ export default function (
|
|||
return super.render(request, routeData, locals);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export function createExports(manifest) {
|
||||
return {
|
||||
manifest,
|
||||
createApp: (streaming) => new MyApp(manifest, streaming)
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
`;
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
import { polyfill } from '@astrojs/webapi';
|
||||
import { execa } from 'execa';
|
||||
import fastGlob from 'fast-glob';
|
||||
import fs from 'fs';
|
||||
import os from 'os';
|
||||
import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import stripAnsi from 'strip-ansi';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { sync } from '../dist/core/sync/index.js';
|
||||
import { check } from '../dist/cli/check/index.js';
|
||||
import build from '../dist/core/build/index.js';
|
||||
import { RESOLVED_SPLIT_MODULE_ID } from '../dist/core/build/plugins/plugin-ssr.js';
|
||||
import { getVirtualModulePageNameFromPath } from '../dist/core/build/plugins/util.js';
|
||||
import { makeSplitEntryPointFileName } from '../dist/core/build/static-build.js';
|
||||
import { openConfig } from '../dist/core/config/config.js';
|
||||
import { createSettings } from '../dist/core/config/index.js';
|
||||
import dev from '../dist/core/dev/index.js';
|
||||
import { nodeLogDestination } from '../dist/core/logger/node.js';
|
||||
import preview from '../dist/core/preview/index.js';
|
||||
import { check } from '../dist/cli/check/index.js';
|
||||
import { getVirtualModulePageNameFromPath } from '../dist/core/build/plugins/util.js';
|
||||
import { RESOLVED_SPLIT_MODULE_ID } from '../dist/core/build/plugins/plugin-ssr.js';
|
||||
import { makeSplitEntryPointFileName } from '../dist/core/build/static-build.js';
|
||||
import { sync } from '../dist/core/sync/index.js';
|
||||
|
||||
// polyfill WebAPIs to globalThis for Node v12, Node v14, and Node v16
|
||||
polyfill(globalThis, {
|
||||
|
|
|
@ -2,7 +2,7 @@ import { resolveConfig } from 'vite';
|
|||
import { expect } from 'chai';
|
||||
import { cachedCompilation } from '../../../dist/core/compile/index.js';
|
||||
import { AggregateError } from '../../../dist/core/errors/index.js';
|
||||
import { pathToFileURL } from 'url';
|
||||
import { pathToFileURL } from 'node:url';
|
||||
|
||||
describe('astro/src/core/compile', () => {
|
||||
describe('Invalid CSS', () => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { expect } from 'chai';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { defaultLogging } from '../test-utils.js';
|
||||
import { openConfig } from '../../../dist/core/config/index.js';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { expect } from 'chai';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { loadTSConfig, updateTSConfigForFramework } from '../../../dist/core/config/index.js';
|
||||
import * as path from 'path';
|
||||
import * as path from 'node:path';
|
||||
import * as tsr from 'tsconfig-resolver';
|
||||
|
||||
const cwd = fileURLToPath(new URL('../../fixtures/tsconfig-handling/', import.meta.url));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { expect } from 'chai';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { validateConfig } from '../../../dist/core/config/config.js';
|
||||
import { createSettings } from '../../../dist/core/config/index.js';
|
||||
import { sync as _sync } from '../../../dist/core/sync/index.js';
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { expect } from 'chai';
|
||||
import * as cheerio from 'cheerio';
|
||||
import os from 'os';
|
||||
import os from 'node:os';
|
||||
|
||||
import { runInContainer } from '../../../dist/core/dev/index.js';
|
||||
import { createFsWithFallback, createRequestAndResponse } from '../test-utils.js';
|
||||
import mdx from '../../../../integrations/mdx/dist/index.js';
|
||||
import { attachContentServerListeners } from '../../../dist/content/server-listeners.js';
|
||||
import { runInContainer } from '../../../dist/core/dev/index.js';
|
||||
import { createFsWithFallback, createRequestAndResponse } from '../test-utils.js';
|
||||
|
||||
const root = new URL('../../fixtures/content/', import.meta.url);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { expect } from 'chai';
|
||||
import * as cheerio from 'cheerio';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
import {
|
||||
createContainerWithAutomaticRestart,
|
||||
|
@ -30,7 +30,7 @@ describe('dev container restarts', () => {
|
|||
</html>
|
||||
`,
|
||||
'/astro.config.mjs': `
|
||||
|
||||
|
||||
`,
|
||||
},
|
||||
root
|
||||
|
|
|
@ -3,7 +3,7 @@ import { expect } from 'chai';
|
|||
import { createFs } from '../test-utils.js';
|
||||
import { createRouteManifest } from '../../../dist/core/routing/manifest/create.js';
|
||||
import { createDefaultDevSettings } from '../../../dist/core/config/index.js';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { defaultLogging } from '../test-utils.js';
|
||||
|
||||
const root = new URL('../../fixtures/alias/', import.meta.url);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// @ts-check
|
||||
import { createFs, createRequestAndResponse, defaultLogging } from '../test-utils.js';
|
||||
import { createRouteManifest, matchAllRoutes } from '../../../dist/core/routing/index.js';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { createViteLoader } from '../../../dist/core/module-loader/vite.js';
|
||||
import { createDevelopmentEnvironment } from '../../../dist/core/render/dev/environment.js';
|
||||
import { expect } from 'chai';
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { EventEmitter } from 'events';
|
||||
import { Volume } from 'memfs';
|
||||
import httpMocks from 'node-mocks-http';
|
||||
import { EventEmitter } from 'node:events';
|
||||
import realFS from 'node:fs';
|
||||
import npath from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { unixify } from './correct-path.js';
|
||||
import npath from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { getDefaultClientDirectives } from '../../dist/core/client-directive/index.js';
|
||||
import { nodeLogDestination } from '../../dist/core/logger/node.js';
|
||||
import { createEnvironment } from '../../dist/core/render/index.js';
|
||||
import { RouteCache } from '../../dist/core/render/route-cache.js';
|
||||
import { nodeLogDestination } from '../../dist/core/logger/node.js';
|
||||
import { unixify } from './correct-path.js';
|
||||
|
||||
/** @type {import('../../src/core/logger/core').LogOptions} */
|
||||
export const defaultLogging = {
|
||||
|
@ -99,7 +99,7 @@ export function createFsWithFallback(json, root) {
|
|||
/**
|
||||
*
|
||||
* @param {import('../../src/core/dev/container').Container} container
|
||||
* @param {typeof import('fs')} fs
|
||||
* @param {typeof import('node:fs')} fs
|
||||
* @param {string} shortPath
|
||||
* @param {'change'} eventType
|
||||
*/
|
||||
|
|
|
@ -2,7 +2,7 @@ import { expect } from 'chai';
|
|||
import { resolveConfig } from 'vite';
|
||||
import { cachedFullCompilation } from '../../../dist/vite-plugin-astro/compile.js';
|
||||
import { init, parse } from 'es-module-lexer';
|
||||
import { pathToFileURL } from 'url';
|
||||
import { pathToFileURL } from 'node:url';
|
||||
|
||||
const viteConfig = await resolveConfig({ configFile: false }, 'serve');
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { expect } from 'chai';
|
||||
|
||||
import fs from 'fs';
|
||||
import { execa } from 'execa';
|
||||
import fs from 'node:fs';
|
||||
|
||||
import { git } from '../dist/index.js';
|
||||
import { setup } from './utils.js';
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue