mirror of
https://github.com/vitejs/vite.git
synced 2026-10-28 08:25:27 +08:00
chore: use oxfmt sortImports (#23319)
This commit is contained in:
246 files changed
+981
-988
No files matched your search
@@ -3,6 +3,11 @@
|
||||
"singleQuote": true,
|
||||
"printWidth": 80,
|
||||
"sortPackageJson": false,
|
||||
"sortImports": {
|
||||
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
|
||||
"partitionByNewline": true,
|
||||
"newlinesBetween": false
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["**/*.json5"],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import path from 'node:path'
|
||||
import { writeFileSync } from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import { Feed } from 'feed'
|
||||
import type { SiteConfig } from 'vitepress'
|
||||
import { createContentLoader } from 'vitepress'
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import path from 'node:path'
|
||||
import { transformerTwoslash } from '@shikijs/vitepress-twoslash'
|
||||
import type { FooterLink } from '@voidzero-dev/vitepress-theme'
|
||||
import { extendConfig } from '@voidzero-dev/vitepress-theme/config'
|
||||
import { markdownItImageSize } from 'markdown-it-image-size'
|
||||
import type { HeadConfig } from 'vitepress'
|
||||
import { defineConfig } from 'vitepress'
|
||||
import { transformerTwoslash } from '@shikijs/vitepress-twoslash'
|
||||
import { graphvizMarkdownPlugin } from 'vitepress-plugin-graphviz'
|
||||
import {
|
||||
groupIconMdPlugin,
|
||||
groupIconVitePlugin,
|
||||
} from 'vitepress-plugin-group-icons'
|
||||
import { graphvizMarkdownPlugin } from 'vitepress-plugin-graphviz'
|
||||
import llmstxt from 'vitepress-plugin-llms'
|
||||
import { markdownItImageSize } from 'markdown-it-image-size'
|
||||
import { extendConfig } from '@voidzero-dev/vitepress-theme/config'
|
||||
import type { FooterLink } from '@voidzero-dev/vitepress-theme'
|
||||
import packageJson from '../../packages/vite/package.json' with { type: 'json' }
|
||||
import { buildEnd } from './buildEnd.config.ts'
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import {
|
||||
VPDocAsideSponsors,
|
||||
type Sponsors,
|
||||
} from '@voidzero-dev/vitepress-theme'
|
||||
import { computed } from 'vue'
|
||||
import { useSponsor } from '../composables/sponsor'
|
||||
|
||||
const data = useSponsor()
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, inject } from 'vue'
|
||||
import { useData } from 'vitepress'
|
||||
import { Icon } from '@iconify/vue'
|
||||
import {
|
||||
themeContextKey,
|
||||
type BannerConfig,
|
||||
} from '@voidzero-dev/vitepress-theme'
|
||||
import { useData } from 'vitepress'
|
||||
import { computed, inject } from 'vue'
|
||||
|
||||
const { theme, frontmatter } = useData()
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { onMounted, ref } from 'vue'
|
||||
import type { Sponsor, SponsorTier } from '@voidzero-dev/vitepress-theme'
|
||||
import { onMounted, ref } from 'vue'
|
||||
|
||||
interface Sponsors {
|
||||
main: Sponsor[]
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { h } from 'vue'
|
||||
import TwoslashFloatingVue from '@shikijs/vitepress-twoslash/client'
|
||||
import Theme from '@voidzero-dev/vitepress-theme/src/vite'
|
||||
import '@shikijs/vitepress-twoslash/style.css'
|
||||
import 'virtual:group-icons.css'
|
||||
import 'vitepress-plugin-graphviz/style.css'
|
||||
import Theme from '@voidzero-dev/vitepress-theme/src/vite'
|
||||
import { h } from 'vue'
|
||||
import './styles.css'
|
||||
|
||||
// components
|
||||
import AsideSponsors from './components/AsideSponsors.vue'
|
||||
import NonInheritBadge from './components/NonInheritBadge.vue'
|
||||
import ScrimbaLink from './components/ScrimbaLink.vue'
|
||||
import SvgImage from './components/SvgImage.vue'
|
||||
import YouTubeVideo from './components/YouTubeVideo.vue'
|
||||
import NonInheritBadge from './components/NonInheritBadge.vue'
|
||||
import AsideSponsors from './components/AsideSponsors.vue'
|
||||
import ScrimbaLink from './components/ScrimbaLink.vue'
|
||||
|
||||
export default {
|
||||
Layout() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup>
|
||||
import RiveAnimation from '@components/shared/RiveAnimation.vue'
|
||||
import viteAnimation from '@assets/vite/animations/563_x_420_rich_features.riv'
|
||||
import RiveAnimation from '@components/shared/RiveAnimation.vue'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup>
|
||||
import RiveAnimation from '@components/shared/RiveAnimation.vue'
|
||||
import flexiblePluginAnimation from '@assets/vite/animations/640_x_300_flexible_plugin.riv'
|
||||
import RiveAnimation from '@components/shared/RiveAnimation.vue'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup>
|
||||
import RiveAnimation from '@components/shared/RiveAnimation.vue'
|
||||
import CodeGroup from '@components/shared/CodeGroup.vue'
|
||||
import RiveAnimation from '@components/shared/RiveAnimation.vue'
|
||||
|
||||
import viteAnimation from '@assets/vite/animations/641_x_629_vite_masthead.riv'
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<script setup>
|
||||
// these components live in @voidzero-dev/vitepress-theme
|
||||
import Footer from '@components/oss/Footer.vue'
|
||||
import HeadingSection from '@components/oss/HeadingSection.vue'
|
||||
import Sponsors from '@components/oss/Sponsors.vue'
|
||||
import TrustedBy from '@components/oss/TrustedBy.vue'
|
||||
import Spacer from '@components/shared/Spacer.vue'
|
||||
import { computed } from 'vue'
|
||||
import Hero from './Hero.vue'
|
||||
import { useSponsor } from '../composables/sponsor'
|
||||
import ViteCommunity from './Community.vue'
|
||||
import ViteFeatureGrid1 from './FeatureGrid1.vue'
|
||||
import ViteFeatureGrid2 from './FeatureGrid2.vue'
|
||||
import ViteFrameworks from './Frameworks.vue'
|
||||
import ViteCommunity from './Community.vue'
|
||||
import TrustedBy from '@components/oss/TrustedBy.vue'
|
||||
import HeadingSection from '@components/oss/HeadingSection.vue'
|
||||
import Sponsors from '@components/oss/Sponsors.vue'
|
||||
import Spacer from '@components/shared/Spacer.vue'
|
||||
import Footer from '@components/oss/Footer.vue'
|
||||
import { useSponsor } from '../composables/sponsor'
|
||||
import Hero from './Hero.vue'
|
||||
|
||||
const data = useSponsor()
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<script setup>
|
||||
import Hero from './Hero.vue'
|
||||
import Timer from './Timer.vue'
|
||||
import TimeoutSwitcher from './TimeoutSwitcher.vue'
|
||||
import VideoIframe from './VideoIframe.vue'
|
||||
import Events from './Events.vue'
|
||||
import Footer from '@components/oss/Footer.vue'
|
||||
import Events from './Events.vue'
|
||||
import Hero from './Hero.vue'
|
||||
import TimeoutSwitcher from './TimeoutSwitcher.vue'
|
||||
import Timer from './Timer.vue'
|
||||
import VideoIframe from './VideoIframe.vue'
|
||||
const startTime = '2026-03-19T15:00:00.000Z'
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup>
|
||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
||||
import Header from '@components/oss/Header.vue'
|
||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
||||
import { useYoutubePlayer } from './useYoutubePlayer'
|
||||
|
||||
const props = defineProps({
|
||||
|
||||
+2
-15
@@ -1,11 +1,11 @@
|
||||
// @ts-check
|
||||
import eslint from '@eslint/js'
|
||||
import pluginN from 'eslint-plugin-n'
|
||||
import pluginImportX from 'eslint-plugin-import-x'
|
||||
import pluginN from 'eslint-plugin-n'
|
||||
import pluginRegExp from 'eslint-plugin-regexp'
|
||||
import tseslint from 'typescript-eslint'
|
||||
import { defineConfig } from 'eslint/config'
|
||||
import globals from 'globals'
|
||||
import tseslint from 'typescript-eslint'
|
||||
|
||||
// Some rules work better with typechecking enabled, but as enabling it is slow,
|
||||
// we only do so when linting in IDEs for now. If you want to lint with typechecking
|
||||
@@ -149,19 +149,6 @@ export default defineConfig(
|
||||
'@typescript-eslint/unbound-method': 'off',
|
||||
|
||||
'import-x/no-duplicates': 'error',
|
||||
'import-x/order': [
|
||||
'error',
|
||||
{
|
||||
groups: [
|
||||
'builtin',
|
||||
'external',
|
||||
'internal',
|
||||
'parent',
|
||||
'sibling',
|
||||
'index',
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
'regexp/prefer-regexp-exec': 'error',
|
||||
'regexp/prefer-regexp-test': 'error',
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import type { SpawnOptions } from 'node:child_process'
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import util from 'node:util'
|
||||
import type { SpawnOptions } from 'node:child_process'
|
||||
import spawn from 'cross-spawn'
|
||||
import mri from 'mri'
|
||||
import * as prompts from '@clack/prompts'
|
||||
import { determineAgent } from '@vercel/detect-agent'
|
||||
import spawn from 'cross-spawn'
|
||||
import mri from 'mri'
|
||||
|
||||
const {
|
||||
blue,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { LitElement, css, html } from 'lit'
|
||||
import { customElement, property } from 'lit/decorators.js'
|
||||
import heroImg from './assets/hero.png'
|
||||
import litLogo from './assets/lit.svg'
|
||||
import viteLogo from './assets/vite.svg'
|
||||
import heroImg from './assets/hero.png'
|
||||
|
||||
/**
|
||||
* An example element.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { LitElement, css, html } from 'lit'
|
||||
import heroImg from './assets/hero.png'
|
||||
import litLogo from './assets/lit.svg'
|
||||
import viteLogo from './assets/vite.svg'
|
||||
import heroImg from './assets/hero.png'
|
||||
|
||||
/**
|
||||
* An example element.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useState } from 'preact/hooks'
|
||||
import heroImg from './assets/hero.png'
|
||||
import preactLogo from './assets/preact.svg'
|
||||
import viteLogo from './assets/vite.svg'
|
||||
import heroImg from './assets/hero.png'
|
||||
import './app.css'
|
||||
|
||||
export function App() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import preact from '@preact/preset-vite'
|
||||
import { defineConfig } from 'vite'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useState } from 'preact/hooks'
|
||||
import heroImg from './assets/hero.png'
|
||||
import preactLogo from './assets/preact.svg'
|
||||
import viteLogo from './assets/vite.svg'
|
||||
import heroImg from './assets/hero.png'
|
||||
import './app.css'
|
||||
|
||||
export function App() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import preact from '@preact/preset-vite'
|
||||
import { defineConfig } from 'vite'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { component$, useSignal } from '@builder.io/qwik'
|
||||
|
||||
import heroImg from './assets/hero.png'
|
||||
import qwikLogo from './assets/qwik.svg'
|
||||
import viteLogo from './assets/vite.svg'
|
||||
import heroImg from './assets/hero.png'
|
||||
import './app.css'
|
||||
|
||||
export const App = component$(() => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import { qwikVite } from '@builder.io/qwik/optimizer'
|
||||
import { defineConfig } from 'vite'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { component$, useSignal } from '@builder.io/qwik'
|
||||
|
||||
import heroImg from './assets/hero.png'
|
||||
import qwikLogo from './assets/qwik.svg'
|
||||
import viteLogo from './assets/vite.svg'
|
||||
import heroImg from './assets/hero.png'
|
||||
import './app.css'
|
||||
|
||||
export const App = component$(() => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import { qwikVite } from '@builder.io/qwik/optimizer'
|
||||
import { defineConfig } from 'vite'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useState } from 'react'
|
||||
import heroImg from './assets/hero.png'
|
||||
import reactLogo from './assets/react.svg'
|
||||
import viteLogo from './assets/vite.svg'
|
||||
import heroImg from './assets/hero.png'
|
||||
import './App.css'
|
||||
|
||||
function App() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import { defineConfig } from 'vite'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useState } from 'react'
|
||||
import heroImg from './assets/hero.png'
|
||||
import reactLogo from './assets/react.svg'
|
||||
import viteLogo from './assets/vite.svg'
|
||||
import heroImg from './assets/hero.png'
|
||||
import './App.css'
|
||||
|
||||
function App() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import { defineConfig } from 'vite'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { createSignal } from 'solid-js'
|
||||
import heroImg from './assets/hero.png'
|
||||
import solidLogo from './assets/solid.svg'
|
||||
import viteLogo from './assets/vite.svg'
|
||||
import heroImg from './assets/hero.png'
|
||||
import './App.css'
|
||||
|
||||
function App() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { createSignal } from 'solid-js'
|
||||
import heroImg from './assets/hero.png'
|
||||
import solidLogo from './assets/solid.svg'
|
||||
import viteLogo from './assets/vite.svg'
|
||||
import heroImg from './assets/hero.png'
|
||||
import './App.css'
|
||||
|
||||
function App() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
||||
import { defineConfig } from 'vite'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
||||
import { defineConfig } from 'vite'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import './style.css'
|
||||
import heroImg from './assets/hero.png'
|
||||
import typescriptLogo from './assets/typescript.svg'
|
||||
import viteLogo from './assets/vite.svg'
|
||||
import heroImg from './assets/hero.png'
|
||||
import { setupCounter } from './counter.ts'
|
||||
|
||||
document.querySelector<HTMLDivElement>('#app')!.innerHTML = `
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import './style.css'
|
||||
import heroImg from './assets/hero.png'
|
||||
import javascriptLogo from './assets/javascript.svg'
|
||||
import viteLogo from './assets/vite.svg'
|
||||
import heroImg from './assets/hero.png'
|
||||
import { setupCounter } from './counter.js'
|
||||
|
||||
document.querySelector('#app').innerHTML = `
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import viteLogo from '../assets/vite.svg'
|
||||
import heroImg from '../assets/hero.png'
|
||||
import viteLogo from '../assets/vite.svg'
|
||||
import vueLogo from '../assets/vue.svg'
|
||||
|
||||
const count = ref(0)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { defineConfig } from 'vite'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import viteLogo from '../assets/vite.svg'
|
||||
import heroImg from '../assets/hero.png'
|
||||
import viteLogo from '../assets/vite.svg'
|
||||
import vueLogo from '../assets/vue.svg'
|
||||
|
||||
const count = ref(0)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { defineConfig } from 'vite'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import type { ecmaVersion } from 'acorn'
|
||||
import { parse } from 'acorn'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import {
|
||||
createModernChunkLegacyGuard,
|
||||
detectModernBrowserCode,
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
import path from 'node:path'
|
||||
import crypto from 'node:crypto'
|
||||
import { createRequire } from 'node:module'
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { build, normalizePath } from 'vite'
|
||||
import type {
|
||||
PluginItem as BabelPlugin,
|
||||
types as BabelTypes,
|
||||
} from '@babel/core'
|
||||
import browserslist from 'browserslist'
|
||||
import MagicString from 'magic-string'
|
||||
import colors from 'picocolors'
|
||||
import { build, normalizePath } from 'vite'
|
||||
import type {
|
||||
BuildOptions,
|
||||
HtmlTagDescriptor,
|
||||
@@ -11,13 +17,6 @@ import type {
|
||||
ResolvedConfig,
|
||||
Rollup,
|
||||
} from 'vite'
|
||||
import type {
|
||||
PluginItem as BabelPlugin,
|
||||
types as BabelTypes,
|
||||
} from '@babel/core'
|
||||
import colors from 'picocolors'
|
||||
import browserslist from 'browserslist'
|
||||
import type { Options } from './types'
|
||||
import {
|
||||
createModernChunkLegacyGuard,
|
||||
detectModernBrowserCode,
|
||||
@@ -27,6 +26,7 @@ import {
|
||||
safari10NoModuleFix,
|
||||
systemJSInlineCode,
|
||||
} from './snippets'
|
||||
import type { Options } from './types'
|
||||
|
||||
// lazy load babel since it's not used during dev
|
||||
let babel: Promise<typeof import('@babel/core')> | undefined
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
import { performance } from 'node:perf_hooks'
|
||||
import module from 'node:module'
|
||||
import { performance } from 'node:perf_hooks'
|
||||
|
||||
if (!import.meta.url.includes('node_modules')) {
|
||||
if (!process.env.DEBUG_DISABLE_SOURCE_MAP) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { writeFileSync } from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import { ImportType, init, parse } from 'es-module-lexer'
|
||||
import MagicString from 'magic-string'
|
||||
import type { Plugin } from 'rolldown'
|
||||
import { defineConfig } from 'rolldown'
|
||||
import { ImportType, init, parse } from 'es-module-lexer'
|
||||
import licensePlugin from './rollupLicensePlugin'
|
||||
import pkg from './package.json' with { type: 'json' }
|
||||
import licensePlugin from './rollupLicensePlugin'
|
||||
|
||||
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
||||
const dirname = import.meta.dirname
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { builtinModules } from 'node:module'
|
||||
import { parse as parseWithBabel } from '@babel/parser'
|
||||
import { walk } from 'estree-walker'
|
||||
import MagicString from 'magic-string'
|
||||
import { defineConfig } from 'rolldown'
|
||||
import type {
|
||||
OutputChunk,
|
||||
@@ -6,12 +9,9 @@ import type {
|
||||
PluginContext,
|
||||
RenderedChunk,
|
||||
} from 'rolldown'
|
||||
import type { ESTree } from 'rolldown/utils'
|
||||
import { parseAst } from 'rolldown/parseAst'
|
||||
import { dts } from 'rolldown-plugin-dts'
|
||||
import { parse as parseWithBabel } from '@babel/parser'
|
||||
import { walk } from 'estree-walker'
|
||||
import MagicString from 'magic-string'
|
||||
import { parseAst } from 'rolldown/parseAst'
|
||||
import type { ESTree } from 'rolldown/utils'
|
||||
import pkg from './package.json' with { type: 'json' }
|
||||
|
||||
type Directive = ESTree.Directive
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import fs from 'node:fs'
|
||||
import license from 'rollup-plugin-license'
|
||||
import type { Dependency } from 'rollup-plugin-license'
|
||||
import colors from 'picocolors'
|
||||
import type { Plugin, PluginContext } from 'rollup'
|
||||
import license from 'rollup-plugin-license'
|
||||
import type { Dependency } from 'rollup-plugin-license'
|
||||
|
||||
export default function licensePlugin(
|
||||
licenseFilePath: string,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import type { ErrorPayload, HotPayload } from '#types/hmrPayload'
|
||||
import type { ViteHotContext } from '#types/hot'
|
||||
import { setupForwardConsoleHandler } from '../shared/forwardConsole'
|
||||
import { HMRClient, HMRContext } from '../shared/hmr'
|
||||
import { wrapId } from '../shared/utils'
|
||||
import { createHMRHandler } from '../shared/hmrHandler'
|
||||
import {
|
||||
createWebSocketModuleRunnerTransport,
|
||||
normalizeModuleRunnerTransport,
|
||||
} from '../shared/moduleRunnerTransport'
|
||||
import { createHMRHandler } from '../shared/hmrHandler'
|
||||
import { setupForwardConsoleHandler } from '../shared/forwardConsole'
|
||||
import { wrapId } from '../shared/utils'
|
||||
import type { BundledDevHMRClient } from './bundledDevHmrClient'
|
||||
import { ErrorOverlay, cspNonce, overlayId } from './overlay'
|
||||
// @ts-expect-error internal virtual module
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { cleanUrl, isWindows, slash, unwrapId } from '../shared/utils'
|
||||
import { SOURCEMAPPING_URL } from '../shared/constants'
|
||||
import { decodeBase64 } from './utils'
|
||||
import { cleanUrl, isWindows, slash, unwrapId } from '../shared/utils'
|
||||
import { DecodedMap } from './sourcemap/decoder'
|
||||
import type { ResolvedResult } from './types'
|
||||
import { decodeBase64 } from './utils'
|
||||
|
||||
const MODULE_RUNNER_SOURCEMAPPING_REGEXP = new RegExp(
|
||||
`//# ${SOURCEMAPPING_URL}=data:application/json;base64,(.+)`,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { HotPayload } from '#types/hmrPayload'
|
||||
import { slash } from '../shared/utils'
|
||||
import { ERR_OUTDATED_OPTIMIZED_DEP } from '../shared/constants'
|
||||
import { createHMRHandler } from '../shared/hmrHandler'
|
||||
import { slash } from '../shared/utils'
|
||||
import type { ModuleRunner } from './runner'
|
||||
|
||||
export function createHMRHandlerForRunner(
|
||||
|
||||
@@ -1,22 +1,12 @@
|
||||
import type { ViteHotContext } from '#types/hot'
|
||||
import { createIsBuiltin } from '../shared/builtin'
|
||||
import { HMRClient, HMRContext, type HMRLogger } from '../shared/hmr'
|
||||
import { cleanUrl, isPrimitive } from '../shared/utils'
|
||||
import { analyzeImportedModDifference } from '../shared/ssrTransform'
|
||||
import {
|
||||
type NormalizedModuleRunnerTransport,
|
||||
normalizeModuleRunnerTransport,
|
||||
} from '../shared/moduleRunnerTransport'
|
||||
import { createIsBuiltin } from '../shared/builtin'
|
||||
import type { EvaluatedModuleNode } from './evaluatedModules'
|
||||
import { EvaluatedModules } from './evaluatedModules'
|
||||
import type {
|
||||
ModuleEvaluator,
|
||||
ModuleRunnerContext,
|
||||
ModuleRunnerOptions,
|
||||
ResolvedResult,
|
||||
SSRImportMetadata,
|
||||
} from './types'
|
||||
import { posixDirname, posixPathToFileHref, posixResolve } from './utils'
|
||||
import { analyzeImportedModDifference } from '../shared/ssrTransform'
|
||||
import { cleanUrl, isPrimitive } from '../shared/utils'
|
||||
import {
|
||||
ssrDynamicImportKey,
|
||||
ssrExportAllKey,
|
||||
@@ -25,11 +15,21 @@ import {
|
||||
ssrImportMetaKey,
|
||||
ssrModuleExportsKey,
|
||||
} from './constants'
|
||||
import { hmrLogger, silentConsole } from './hmrLogger'
|
||||
import { createHMRHandlerForRunner } from './hmrHandler'
|
||||
import { enableSourceMapSupport } from './sourcemap/index'
|
||||
import { ESModulesEvaluator } from './esmEvaluator'
|
||||
import { createDefaultImportMeta } from './createImportMeta'
|
||||
import { ESModulesEvaluator } from './esmEvaluator'
|
||||
import type { EvaluatedModuleNode } from './evaluatedModules'
|
||||
import { EvaluatedModules } from './evaluatedModules'
|
||||
import { createHMRHandlerForRunner } from './hmrHandler'
|
||||
import { hmrLogger, silentConsole } from './hmrLogger'
|
||||
import { enableSourceMapSupport } from './sourcemap/index'
|
||||
import type {
|
||||
ModuleEvaluator,
|
||||
ModuleRunnerContext,
|
||||
ModuleRunnerOptions,
|
||||
ResolvedResult,
|
||||
SSRImportMetadata,
|
||||
} from './types'
|
||||
import { posixDirname, posixPathToFileHref, posixResolve } from './utils'
|
||||
|
||||
interface ModuleRunnerDebugger {
|
||||
(formatter: unknown, ...args: unknown[]): void
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { OriginalMapping } from '@jridgewell/trace-mapping'
|
||||
import { slash } from '../../shared/utils'
|
||||
import type { EvaluatedModules } from '../evaluatedModules'
|
||||
import type { ModuleRunner } from '../runner'
|
||||
import { decodeBase64, posixDirname, posixResolve } from '../utils'
|
||||
import type { EvaluatedModules } from '../evaluatedModules'
|
||||
import { slash } from '../../shared/utils'
|
||||
import { DecodedMap, getOriginalPosition } from './decoder'
|
||||
|
||||
interface RetrieveFileHandler {
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import type { ViteHotContext } from '#types/hot'
|
||||
import type { HMRLogger } from '../shared/hmr'
|
||||
import type {
|
||||
DefineImportMetadata,
|
||||
SSRImportMetadata,
|
||||
} from '../shared/ssrTransform'
|
||||
import type {
|
||||
ExternalFetchResult,
|
||||
FetchFunctionOptions,
|
||||
@@ -11,7 +7,10 @@ import type {
|
||||
ViteFetchResult,
|
||||
} from '../shared/invokeMethods'
|
||||
import type { ModuleRunnerTransport } from '../shared/moduleRunnerTransport'
|
||||
import type { EvaluatedModuleNode, EvaluatedModules } from './evaluatedModules'
|
||||
import type {
|
||||
DefineImportMetadata,
|
||||
SSRImportMetadata,
|
||||
} from '../shared/ssrTransform'
|
||||
import type {
|
||||
ssrDynamicImportKey,
|
||||
ssrExportAllKey,
|
||||
@@ -20,6 +19,7 @@ import type {
|
||||
ssrImportMetaKey,
|
||||
ssrModuleExportsKey,
|
||||
} from './constants'
|
||||
import type { EvaluatedModuleNode, EvaluatedModules } from './evaluatedModules'
|
||||
import type { InterceptorOptions } from './sourcemap/interceptor'
|
||||
|
||||
export type { DefineImportMetadata, SSRImportMetadata }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { type DefaultTreeAdapterMap, parseFragment } from 'parse5'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { getNodeAssetAttributes } from '../assetSource'
|
||||
|
||||
describe('getNodeAssetAttributes', () => {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import fsp from 'node:fs/promises'
|
||||
import { basename, resolve } from 'node:path'
|
||||
import { stripVTControlCharacters } from 'node:util'
|
||||
import fsp from 'node:fs/promises'
|
||||
import colors from 'picocolors'
|
||||
import { afterEach, describe, expect, assert, test, vi } from 'vitest'
|
||||
import type {
|
||||
LogLevel,
|
||||
OutputAsset,
|
||||
@@ -12,6 +11,8 @@ import type {
|
||||
RolldownOutput,
|
||||
RollupLog,
|
||||
} from 'rolldown'
|
||||
import { afterEach, describe, expect, assert, test, vi } from 'vitest'
|
||||
import { BuildEnvironment, resolveConfig } from '..'
|
||||
import type { LibraryFormats, LibraryOptions } from '../build'
|
||||
import {
|
||||
ChunkMetadataMap,
|
||||
@@ -24,7 +25,6 @@ import {
|
||||
} from '../build'
|
||||
import type { Logger } from '../logger'
|
||||
import { createLogger } from '../logger'
|
||||
import { BuildEnvironment, resolveConfig } from '..'
|
||||
|
||||
const dirname = import.meta.dirname
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import fs from 'node:fs'
|
||||
import http from 'node:http'
|
||||
import os from 'node:os'
|
||||
import path from 'node:path'
|
||||
import fs from 'node:fs'
|
||||
import { stripVTControlCharacters } from 'node:util'
|
||||
import { afterEach, assert, describe, expect, test, vi } from 'vitest'
|
||||
import type { InlineConfig, PluginOption } from '..'
|
||||
import { isWindows } from '../../shared/utils'
|
||||
import type { UserConfig, UserConfigExport } from '../config'
|
||||
import {
|
||||
bundleConfigFile,
|
||||
@@ -12,16 +13,15 @@ import {
|
||||
loadConfigFromFile,
|
||||
resolveConfig,
|
||||
} from '../config'
|
||||
import { resolveServerOptions } from '../server'
|
||||
import { resolveEnvPrefix } from '../env'
|
||||
import { createLogger } from '../logger'
|
||||
import type { Logger } from '../logger'
|
||||
import { resolveServerOptions } from '../server'
|
||||
import {
|
||||
hasBothRollupOptionsAndRolldownOptions,
|
||||
mergeConfig,
|
||||
normalizePath,
|
||||
} from '../utils'
|
||||
import { createLogger } from '../logger'
|
||||
import type { Logger } from '../logger'
|
||||
import { isWindows } from '../../shared/utils'
|
||||
|
||||
describe('mergeConfig', () => {
|
||||
test('handles configs with different alias schemas', () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import path from 'node:path'
|
||||
import { afterEach, describe, expect, test, vi } from 'vitest'
|
||||
import type { ResolvedServerUrls } from 'vite'
|
||||
import { afterEach, describe, expect, test, vi } from 'vitest'
|
||||
import { createServer, resolveConfig } from '..'
|
||||
import type { ViteDevServer } from '..'
|
||||
import { promiseWithResolvers } from '../../shared/utils'
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import path from 'node:path'
|
||||
import { describe, expect, onTestFinished, test } from 'vitest'
|
||||
import type { RolldownOutput } from 'rolldown'
|
||||
import { createServer } from '../server'
|
||||
import type { InlineConfig } from '../config'
|
||||
import { describe, expect, onTestFinished, test } from 'vitest'
|
||||
import { createBuilder } from '../build'
|
||||
import type { InlineConfig } from '../config'
|
||||
import { createServer } from '../server'
|
||||
import { createServerModuleRunner } from '../ssr/runtime/serverModuleRunner'
|
||||
|
||||
describe('custom environment conditions', () => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { PartialEnvironment } from '../baseEnvironment'
|
||||
import { resolveConfig } from '../config'
|
||||
import { createIsConfiguredAsExternal } from '../external'
|
||||
import { PartialEnvironment } from '../baseEnvironment'
|
||||
|
||||
describe('createIsConfiguredAsExternal', () => {
|
||||
test('default', async () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import moduleCondition from '@vite/test-config-plugin-module-condition'
|
||||
import { array } from '../siblings/foo.js'
|
||||
import importsField from '#imports-field'
|
||||
import { array } from '../siblings/foo.js'
|
||||
|
||||
export default {
|
||||
array,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import type { OutputBundle, OutputChunk } from 'rolldown'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { getCssFilesForChunk } from '../plugins/html'
|
||||
|
||||
function createChunk(
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import http from 'node:http'
|
||||
import net from 'node:net'
|
||||
import { afterEach, describe, expect, test, vi } from 'vitest'
|
||||
import { wildcardHosts } from '../constants'
|
||||
import { createServer } from '..'
|
||||
import type { InlineConfig, ViteDevServer } from '..'
|
||||
import { wildcardHosts } from '../constants'
|
||||
|
||||
const BASE_PORT = 15181
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { convertEsbuildConfigToOxcConfig } from '../plugins/oxc'
|
||||
import { createLogger } from '../logger'
|
||||
import { convertEsbuildConfigToOxcConfig } from '../plugins/oxc'
|
||||
|
||||
describe('convertEsbuildConfigToOxcConfig', () => {
|
||||
const logger = createLogger('silent')
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { parseAst } from 'rollup/parseAst'
|
||||
import { assetImportMetaUrlPlugin } from '../../plugins/assetImportMetaUrl'
|
||||
import { resolveConfig } from '../../config'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { PartialEnvironment } from '../../baseEnvironment'
|
||||
import { resolveConfig } from '../../config'
|
||||
import { assetImportMetaUrlPlugin } from '../../plugins/assetImportMetaUrl'
|
||||
|
||||
async function createAssetImportMetaurlPluginTransform() {
|
||||
const config = await resolveConfig({ configFile: false }, 'serve')
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import path from 'node:path'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import type { InternalModuleFormat } from 'rolldown'
|
||||
import MagicString from 'magic-string'
|
||||
import type { InternalModuleFormat } from 'rolldown'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { PartialEnvironment } from '../../baseEnvironment'
|
||||
import { resolveConfig } from '../../config'
|
||||
import type { InlineConfig } from '../../config'
|
||||
import {
|
||||
@@ -15,7 +16,6 @@ import {
|
||||
preprocessCSS,
|
||||
resolveLibCssFilename,
|
||||
} from '../../plugins/css'
|
||||
import { PartialEnvironment } from '../../baseEnvironment'
|
||||
import { normalizePath } from '../../utils'
|
||||
|
||||
const dirname = import.meta.dirname
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ChildProcess } from 'node:child_process'
|
||||
import fs from 'node:fs'
|
||||
import os from 'node:os'
|
||||
import path from 'node:path'
|
||||
import type { ChildProcess } from 'node:child_process'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { createServer } from '../../index'
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { rolldown } from 'rolldown'
|
||||
import { definePlugin } from '../../plugins/define'
|
||||
import { resolveConfig } from '../../config'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { PartialEnvironment } from '../../baseEnvironment'
|
||||
import { resolveConfig } from '../../config'
|
||||
import { definePlugin } from '../../plugins/define'
|
||||
|
||||
async function createDefinePluginTransform(
|
||||
define: Record<string, any> = {},
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { resolve } from 'node:path'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { isWindows } from '../../../../shared/utils'
|
||||
import { transformDynamicImport } from '../../../plugins/dynamicImportVars'
|
||||
import { normalizePath } from '../../../utils'
|
||||
import { isWindows } from '../../../../shared/utils'
|
||||
|
||||
const dirname = import.meta.dirname
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import path from 'node:path'
|
||||
import { describe, expect, onTestFinished, test, vi } from 'vitest'
|
||||
import { build } from '../../build'
|
||||
import type { Plugin } from '../../plugin'
|
||||
import { resolveConfig } from '../../config'
|
||||
import { createServer } from '../../server'
|
||||
import { preview } from '../../preview'
|
||||
import { promiseWithResolvers } from '../../../shared/utils'
|
||||
import { build } from '../../build'
|
||||
import { resolveConfig } from '../../config'
|
||||
import { type Logger, createLogger } from '../../logger'
|
||||
import type { Plugin } from '../../plugin'
|
||||
import { preview } from '../../preview'
|
||||
import { createServer } from '../../server'
|
||||
|
||||
const resolveConfigWithPlugin = (
|
||||
plugin: Plugin,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeAll, describe, expect, test } from 'vitest'
|
||||
import { init, parse as parseImports } from 'es-module-lexer'
|
||||
import { beforeAll, describe, expect, test } from 'vitest'
|
||||
import {
|
||||
matchImportsToPreloadMarkers,
|
||||
preloadMarker,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { resolve } from 'node:path'
|
||||
import { promises as fs } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { transformGlobImport } from '../../../plugins/importMetaGlob'
|
||||
import { transformWithOxc } from '../../../plugins/oxc'
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { describe, it } from 'vitest'
|
||||
import type { ModuleFormat, RolldownOutput } from 'rolldown'
|
||||
import { describe, it } from 'vitest'
|
||||
import { build } from '../../../build'
|
||||
import { modulePreloadPolyfillId } from '../../../plugins/modulePreloadPolyfill'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import util from 'node:util'
|
||||
import path from 'node:path'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import util from 'node:util'
|
||||
import type { ModuleTypeFilter } from 'rolldown'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import {
|
||||
type StringFilter,
|
||||
createCodeFilter,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { resolve } from 'node:path'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { build } from 'vite'
|
||||
import type { RollupOutput } from 'rollup'
|
||||
import { build } from 'vite'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import type { TerserOptions } from '../../plugins/terser'
|
||||
|
||||
describe('terser', () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { resolve } from 'node:path'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import type { OutputChunk, RolldownOutput } from 'rolldown'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { build } from '../../build'
|
||||
import { splitWorkerRequest } from '../../plugins/worker'
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { parseAst } from 'rollup/parseAst'
|
||||
import { workerImportMetaUrlPlugin } from '../../plugins/workerImportMetaUrl'
|
||||
import { resolveConfig } from '../../config'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { PartialEnvironment } from '../../baseEnvironment'
|
||||
import { resolveConfig } from '../../config'
|
||||
import { workerImportMetaUrlPlugin } from '../../plugins/workerImportMetaUrl'
|
||||
|
||||
async function createWorkerImportMetaUrlPluginTransform() {
|
||||
const config = await resolveConfig({ configFile: false }, 'serve')
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { join } from 'node:path'
|
||||
import { describe, expect, onTestFinished, test, vi } from 'vitest'
|
||||
import { build } from '../build'
|
||||
import type { EnvironmentOptions, InlineConfig } from '../config'
|
||||
import { createServer } from '../server'
|
||||
import { createServerModuleRunner } from '../ssr/runtime/serverModuleRunner'
|
||||
import type { EnvironmentOptions, InlineConfig } from '../config'
|
||||
import { build } from '../build'
|
||||
|
||||
describe('import and resolveId', () => {
|
||||
async function createTestServer() {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { resolve } from 'node:path'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { loadConfigFromFile } from 'vite'
|
||||
import { runnerImport } from '../ssr/runnerImport'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { slash } from '../../shared/utils'
|
||||
import { runnerImport } from '../ssr/runnerImport'
|
||||
|
||||
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
||||
const isTypeStrippingSupported = !!process.features.typescript
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import path from 'node:path'
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { createServer, createServerModuleRunner } from '..'
|
||||
import {
|
||||
commentRE,
|
||||
devToScanEnvironment,
|
||||
@@ -12,7 +13,6 @@ import {
|
||||
normalizePath,
|
||||
singlelineCommentsRE,
|
||||
} from '../utils'
|
||||
import { createServer, createServerModuleRunner } from '..'
|
||||
|
||||
describe('optimizer-scan:script-test', () => {
|
||||
const scriptContent = `import { defineComponent } from 'vue'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Mock } from 'vitest'
|
||||
import { describe, expect, test, vi } from 'vitest'
|
||||
import { createServer } from '../server'
|
||||
import { preview } from '../preview'
|
||||
import { createServer } from '../server'
|
||||
import { bindCLIShortcuts } from '../shortcuts'
|
||||
|
||||
describe('bindCLIShortcuts', () => {
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import crypto from 'node:crypto'
|
||||
import fs from 'node:fs'
|
||||
import os, { type NetworkInterfaceInfoIPv4 } from 'node:os'
|
||||
import { describe, expect, test, vi, onTestFinished } from 'vitest'
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'mlly'
|
||||
import { describe, expect, test, vi, onTestFinished } from 'vitest'
|
||||
import type { CommonServerOptions, ResolvedServerUrls } from '..'
|
||||
import { isWindows } from '../../shared/utils'
|
||||
import {
|
||||
asyncFlatten,
|
||||
bareImportRE,
|
||||
@@ -27,8 +29,6 @@ import {
|
||||
resolveHostname,
|
||||
resolveServerUrls,
|
||||
} from '../utils'
|
||||
import { isWindows } from '../../shared/utils'
|
||||
import type { CommonServerOptions, ResolvedServerUrls } from '..'
|
||||
|
||||
// Test certificate for SAN parsing (localhost, foo.localhost, *.vite.localhost)
|
||||
// Generate once:
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { Equal, ExpectExtends, ExpectTrue } from '@type-challenges/utils'
|
||||
/**
|
||||
* This is a development only file for testing types.
|
||||
*/
|
||||
import type { Plugin as RolldownPlugin } from 'rolldown'
|
||||
import type { Equal, ExpectExtends, ExpectTrue } from '@type-challenges/utils'
|
||||
import type { Plugin as RollupPlugin } from 'rollup'
|
||||
import type { Plugin, PluginContextExtension, PluginOption } from '../plugin'
|
||||
import type { ROLLUP_HOOKS } from '../constants'
|
||||
import type { Plugin, PluginContextExtension, PluginOption } from '../plugin'
|
||||
import type {
|
||||
GetHookContextMap,
|
||||
NonNeverKeys,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import colors from 'picocolors'
|
||||
import type { Logger } from './logger'
|
||||
import type { ResolvedConfig, ResolvedEnvironmentOptions } from './config'
|
||||
import type { Logger } from './logger'
|
||||
import type { Plugin } from './plugin'
|
||||
|
||||
const environmentColors = [
|
||||
|
||||
@@ -25,16 +25,12 @@ import type {
|
||||
} from 'rolldown'
|
||||
import { viteLoadFallbackPlugin as nativeLoadFallbackPlugin } from 'rolldown/experimental'
|
||||
import { esmExternalRequirePlugin } from 'rolldown/plugins'
|
||||
import type { EsbuildTarget } from '#types/internal/esbuildOptions'
|
||||
import type { RollupCommonJSOptions } from '#dep-types/commonjs'
|
||||
import type { RollupDynamicImportVarsOptions } from '#dep-types/dynamicImportVars'
|
||||
import type { EsbuildTarget } from '#types/internal/esbuildOptions'
|
||||
import type { AssetMetadata, ChunkMetadata } from '#types/metadata'
|
||||
import {
|
||||
DEFAULT_ASSETS_INLINE_LIMIT,
|
||||
ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET,
|
||||
ROLLUP_HOOKS,
|
||||
VERSION,
|
||||
} from './constants'
|
||||
import type { PartialEnvironment } from './baseEnvironment'
|
||||
import { BaseEnvironment } from './baseEnvironment'
|
||||
import type {
|
||||
EnvironmentOptions,
|
||||
InlineConfig,
|
||||
@@ -42,10 +38,37 @@ import type {
|
||||
ResolvedEnvironmentOptions,
|
||||
} from './config'
|
||||
import { resolveConfig } from './config'
|
||||
import type { PartialEnvironment } from './baseEnvironment'
|
||||
import { buildReporterPlugin } from './plugins/reporter'
|
||||
import {
|
||||
DEFAULT_ASSETS_INLINE_LIMIT,
|
||||
ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET,
|
||||
ROLLUP_HOOKS,
|
||||
VERSION,
|
||||
} from './constants'
|
||||
import {
|
||||
isFutureDeprecationEnabled,
|
||||
warnFutureDeprecation,
|
||||
} from './deprecations'
|
||||
import type { Environment } from './environment'
|
||||
import { type Logger } from './logger'
|
||||
import { findNearestMainPackageData, findNearestPackageData } from './packages'
|
||||
import type { PackageCache } from './packages'
|
||||
import { perEnvironmentPlugin } from './plugin'
|
||||
import type { MinimalPluginContextWithoutEnvironment, Plugin } from './plugin'
|
||||
import { getHookHandler } from './plugins'
|
||||
import { buildEsbuildPlugin } from './plugins/esbuild'
|
||||
import { buildImportAnalysisPlugin } from './plugins/importAnalysisBuild'
|
||||
import { type LicenseOptions, licensePlugin } from './plugins/license'
|
||||
import { manifestPlugin } from './plugins/manifest'
|
||||
import { prepareOutDirPlugin } from './plugins/prepareOutDir'
|
||||
import { buildReporterPlugin } from './plugins/reporter'
|
||||
import { type TerserOptions, terserPlugin } from './plugins/terser'
|
||||
import { webWorkerPostPlugin } from './plugins/worker'
|
||||
import {
|
||||
BasicMinimalPluginContext,
|
||||
basePluginContextMeta,
|
||||
} from './server/pluginContainer'
|
||||
import { ssrManifestPlugin } from './ssr/ssrManifestPlugin'
|
||||
import type { RollupPluginHooks } from './typeUtils'
|
||||
import {
|
||||
arraify,
|
||||
asyncFlatten,
|
||||
@@ -59,35 +82,12 @@ import {
|
||||
setupRollupOptionCompat,
|
||||
unique,
|
||||
} from './utils'
|
||||
import { perEnvironmentPlugin } from './plugin'
|
||||
import { manifestPlugin } from './plugins/manifest'
|
||||
import { type Logger } from './logger'
|
||||
import { buildImportAnalysisPlugin } from './plugins/importAnalysisBuild'
|
||||
import { ssrManifestPlugin } from './ssr/ssrManifestPlugin'
|
||||
import { findNearestMainPackageData, findNearestPackageData } from './packages'
|
||||
import type { PackageCache } from './packages'
|
||||
import {
|
||||
convertToWatcherOptions,
|
||||
getResolvedOutDirs,
|
||||
resolveChokidarOptions,
|
||||
resolveEmptyOutDir,
|
||||
} from './watch'
|
||||
import { webWorkerPostPlugin } from './plugins/worker'
|
||||
import { getHookHandler } from './plugins'
|
||||
import { BaseEnvironment } from './baseEnvironment'
|
||||
import type { MinimalPluginContextWithoutEnvironment, Plugin } from './plugin'
|
||||
import type { RollupPluginHooks } from './typeUtils'
|
||||
import { type LicenseOptions, licensePlugin } from './plugins/license'
|
||||
import {
|
||||
BasicMinimalPluginContext,
|
||||
basePluginContextMeta,
|
||||
} from './server/pluginContainer'
|
||||
import {
|
||||
isFutureDeprecationEnabled,
|
||||
warnFutureDeprecation,
|
||||
} from './deprecations'
|
||||
import { prepareOutDirPlugin } from './plugins/prepareOutDir'
|
||||
import type { Environment } from './environment'
|
||||
|
||||
export interface BuildEnvironmentOptions {
|
||||
/**
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import path from 'node:path'
|
||||
import fs from 'node:fs'
|
||||
import { inspect } from 'node:util'
|
||||
import path from 'node:path'
|
||||
import { performance } from 'node:perf_hooks'
|
||||
import { inspect } from 'node:util'
|
||||
import { cac } from 'cac'
|
||||
import colors from 'picocolors'
|
||||
import { VERSION } from './constants'
|
||||
import { createBuilder } from './build'
|
||||
import type { BuildEnvironmentOptions } from './build'
|
||||
import type { ServerOptions } from './server'
|
||||
import type { CLIShortcut } from './shortcuts'
|
||||
import type { InlineConfig } from './config'
|
||||
import { VERSION } from './constants'
|
||||
import type { LogLevel } from './logger'
|
||||
import { createLogger } from './logger'
|
||||
import type { InlineConfig } from './config'
|
||||
import type { ServerOptions } from './server'
|
||||
import type { CLIShortcut } from './shortcuts'
|
||||
|
||||
function checkNodeVersion(nodeVersion: string): boolean {
|
||||
const currentVersion = nodeVersion.split('.')
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
import crypto from 'node:crypto'
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import fsp from 'node:fs/promises'
|
||||
import { createRequire } from 'node:module'
|
||||
import path from 'node:path'
|
||||
import { performance } from 'node:perf_hooks'
|
||||
import { pathToFileURL } from 'node:url'
|
||||
import { inspect, promisify } from 'node:util'
|
||||
import { performance } from 'node:perf_hooks'
|
||||
import { createRequire } from 'node:module'
|
||||
import crypto from 'node:crypto'
|
||||
import type {
|
||||
DevToolsConfig,
|
||||
ResolvedDevToolsConfig,
|
||||
} from '@vitejs/devtools/config'
|
||||
import {
|
||||
getEnv,
|
||||
ignoreInput,
|
||||
ignoreOutput,
|
||||
} from '@voidzero-dev/vite-task-client'
|
||||
import { freshImport } from 'fresh-import'
|
||||
import colors from 'picocolors'
|
||||
import picomatch from 'picomatch'
|
||||
import { freshImport } from 'fresh-import'
|
||||
import {
|
||||
type InputOption,
|
||||
type NormalizedOutputOptions,
|
||||
@@ -24,39 +28,15 @@ import {
|
||||
rolldown,
|
||||
} from 'rolldown'
|
||||
import { isDynamicPattern } from 'tinyglobby'
|
||||
import type {
|
||||
DevToolsConfig,
|
||||
ResolvedDevToolsConfig,
|
||||
} from '@vitejs/devtools/config'
|
||||
import type { Alias, AliasOptions } from '#dep-types/alias'
|
||||
import type { AnymatchFn } from '../types/anymatch'
|
||||
import { withTrailingSlash } from '../shared/utils'
|
||||
import {
|
||||
createImportMetaResolver,
|
||||
importMetaResolveWithCustomHookString,
|
||||
} from '../module-runner/importMetaResolver'
|
||||
import {
|
||||
CLIENT_ENTRY,
|
||||
DEFAULT_ASSETS_RE,
|
||||
DEFAULT_CLIENT_CONDITIONS,
|
||||
DEFAULT_CLIENT_MAIN_FIELDS,
|
||||
DEFAULT_CONFIG_FILES,
|
||||
DEFAULT_EXTENSIONS,
|
||||
DEFAULT_EXTERNAL_CONDITIONS,
|
||||
DEFAULT_PREVIEW_PORT,
|
||||
DEFAULT_SERVER_CONDITIONS,
|
||||
DEFAULT_SERVER_MAIN_FIELDS,
|
||||
ENV_ENTRY,
|
||||
FS_PREFIX,
|
||||
} from './constants'
|
||||
import { resolveEnvironmentPlugins } from './plugin'
|
||||
import type {
|
||||
FalsyPlugin,
|
||||
HookHandler,
|
||||
Plugin,
|
||||
PluginOption,
|
||||
PluginWithRequiredHook,
|
||||
} from './plugin'
|
||||
import { withTrailingSlash } from '../shared/utils'
|
||||
import type { AnymatchFn } from '../types/anymatch'
|
||||
import type { HtmlAssetSource } from './assetSource'
|
||||
import { PartialEnvironment } from './baseEnvironment'
|
||||
import type {
|
||||
BuildEnvironmentOptions,
|
||||
BuilderOptions,
|
||||
@@ -71,19 +51,78 @@ import {
|
||||
resolveBuildEnvironmentOptions,
|
||||
resolveBuilderOptions,
|
||||
} from './build'
|
||||
import type { ResolvedServerOptions, ServerOptions } from './server'
|
||||
import { resolveServerOptions, serverConfigDefaults } from './server'
|
||||
import { DevEnvironment } from './server/environment'
|
||||
import { createRunnableDevEnvironment } from './server/environments/runnableEnvironment'
|
||||
import type { WebSocketServer } from './server/ws'
|
||||
import type { PreviewOptions, ResolvedPreviewOptions } from './preview'
|
||||
import { resolvePreviewOptions } from './preview'
|
||||
import {
|
||||
CLIENT_ENTRY,
|
||||
DEFAULT_ASSETS_RE,
|
||||
DEFAULT_CLIENT_CONDITIONS,
|
||||
DEFAULT_CLIENT_MAIN_FIELDS,
|
||||
DEFAULT_CONFIG_FILES,
|
||||
DEFAULT_EXTENSIONS,
|
||||
DEFAULT_EXTERNAL_CONDITIONS,
|
||||
DEFAULT_PREVIEW_PORT,
|
||||
DEFAULT_SERVER_CONDITIONS,
|
||||
DEFAULT_SERVER_MAIN_FIELDS,
|
||||
ENV_ENTRY,
|
||||
FS_PREFIX,
|
||||
} from './constants'
|
||||
import { loadEnv, resolveEnvPrefix } from './env'
|
||||
import { createIdResolver } from './idResolver'
|
||||
import type { LogLevel, Logger } from './logger'
|
||||
import { createLogger } from './logger'
|
||||
import {
|
||||
createNativeConfigCompatPlugin,
|
||||
formatNativeConfigIncompatWarning,
|
||||
type NativeConfigIncompatibility,
|
||||
} from './nativeConfigCompat'
|
||||
import { nodeResolveWithVite } from './nodeResolve'
|
||||
import type { DepOptimizationOptions } from './optimizer'
|
||||
import { convertEsbuildPluginToRolldownPlugin } from './optimizer/pluginConverter'
|
||||
import type { PackageCache } from './packages'
|
||||
import { findNearestNodeModules, findNearestPackageData } from './packages'
|
||||
import { resolveEnvironmentPlugins } from './plugin'
|
||||
import type {
|
||||
FalsyPlugin,
|
||||
HookHandler,
|
||||
Plugin,
|
||||
PluginOption,
|
||||
PluginWithRequiredHook,
|
||||
} from './plugin'
|
||||
import {
|
||||
createPluginHookUtils,
|
||||
getHookHandler,
|
||||
getSortedPluginsByHook,
|
||||
resolvePlugins,
|
||||
} from './plugins'
|
||||
import {
|
||||
type CSSOptions,
|
||||
type ResolvedCSSOptions,
|
||||
cssConfigDefaults,
|
||||
resolveCSSOptions,
|
||||
} from './plugins/css'
|
||||
import type { ESBuildOptions } from './plugins/esbuild'
|
||||
import type { JsonOptions } from './plugins/json'
|
||||
import { type OxcOptions, convertEsbuildConfigToOxcConfig } from './plugins/oxc'
|
||||
import {
|
||||
type EnvironmentResolveOptions,
|
||||
type InternalResolveOptions,
|
||||
type ResolveOptions,
|
||||
} from './plugins/resolve'
|
||||
import type { PreviewOptions, ResolvedPreviewOptions } from './preview'
|
||||
import { resolvePreviewOptions } from './preview'
|
||||
import type { ResolvedServerOptions, ServerOptions } from './server'
|
||||
import { resolveServerOptions, serverConfigDefaults } from './server'
|
||||
import { DevEnvironment } from './server/environment'
|
||||
import { createRunnableDevEnvironment } from './server/environments/runnableEnvironment'
|
||||
import { getAdditionalAllowedHosts } from './server/middlewares/hostCheck'
|
||||
import {
|
||||
BasicMinimalPluginContext,
|
||||
basePluginContextMeta,
|
||||
} from './server/pluginContainer'
|
||||
import type { WebSocketServer } from './server/ws'
|
||||
import type { ResolvedSSROptions, SSROptions } from './ssr'
|
||||
import { resolveSSROptions, ssrConfigDefaults } from './ssr'
|
||||
import { runnerImport } from './ssr/runnerImport'
|
||||
import type { RequiredExceptFor } from './typeUtils'
|
||||
import {
|
||||
arraify,
|
||||
asyncFlatten,
|
||||
@@ -110,45 +149,6 @@ import {
|
||||
safeRealpathSync,
|
||||
setupRollupOptionCompat,
|
||||
} from './utils'
|
||||
import {
|
||||
createPluginHookUtils,
|
||||
getHookHandler,
|
||||
getSortedPluginsByHook,
|
||||
resolvePlugins,
|
||||
} from './plugins'
|
||||
import type { ESBuildOptions } from './plugins/esbuild'
|
||||
import {
|
||||
type EnvironmentResolveOptions,
|
||||
type InternalResolveOptions,
|
||||
type ResolveOptions,
|
||||
} from './plugins/resolve'
|
||||
import type { LogLevel, Logger } from './logger'
|
||||
import { createLogger } from './logger'
|
||||
import {
|
||||
createNativeConfigCompatPlugin,
|
||||
formatNativeConfigIncompatWarning,
|
||||
type NativeConfigIncompatibility,
|
||||
} from './nativeConfigCompat'
|
||||
import type { DepOptimizationOptions } from './optimizer'
|
||||
import type { JsonOptions } from './plugins/json'
|
||||
import type { HtmlAssetSource } from './assetSource'
|
||||
import type { PackageCache } from './packages'
|
||||
import { findNearestNodeModules, findNearestPackageData } from './packages'
|
||||
import { loadEnv, resolveEnvPrefix } from './env'
|
||||
import type { ResolvedSSROptions, SSROptions } from './ssr'
|
||||
import { resolveSSROptions, ssrConfigDefaults } from './ssr'
|
||||
import { PartialEnvironment } from './baseEnvironment'
|
||||
import { createIdResolver } from './idResolver'
|
||||
import { runnerImport } from './ssr/runnerImport'
|
||||
import { getAdditionalAllowedHosts } from './server/middlewares/hostCheck'
|
||||
import { convertEsbuildPluginToRolldownPlugin } from './optimizer/pluginConverter'
|
||||
import { type OxcOptions, convertEsbuildConfigToOxcConfig } from './plugins/oxc'
|
||||
import type { RequiredExceptFor } from './typeUtils'
|
||||
import {
|
||||
BasicMinimalPluginContext,
|
||||
basePluginContextMeta,
|
||||
} from './server/pluginContainer'
|
||||
import { nodeResolveWithVite } from './nodeResolve'
|
||||
|
||||
const debug = createDebugger('vite:config', { depth: 10 })
|
||||
const promisifiedRealpath = promisify(fs.realpath)
|
||||
|
||||
@@ -5,8 +5,8 @@ import { parseEnv } from 'node:util'
|
||||
import { getEnvs } from '@voidzero-dev/vite-task-client'
|
||||
import { type DotenvPopulateInput, expand } from 'dotenv-expand'
|
||||
import colors from 'picocolors'
|
||||
import { arraify, createDebugger, normalizePath, tryStatSync } from './utils'
|
||||
import type { UserConfig } from './config'
|
||||
import { arraify, createDebugger, normalizePath, tryStatSync } from './utils'
|
||||
|
||||
const debug = createDebugger('vite:env')
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { PluginContext } from 'rolldown'
|
||||
import type { DevEnvironment } from './server/environment'
|
||||
import type { UnknownEnvironment } from './baseEnvironment'
|
||||
import type { BuildEnvironment } from './build'
|
||||
import type { ScanEnvironment } from './optimizer/scan'
|
||||
import type { UnknownEnvironment } from './baseEnvironment'
|
||||
import type { DevEnvironment } from './server/environment'
|
||||
|
||||
export type Environment =
|
||||
| DevEnvironment
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import path from 'node:path'
|
||||
import type { PartialEnvironment } from './baseEnvironment'
|
||||
import type { Environment } from './environment'
|
||||
import type { InternalResolveOptions } from './plugins/resolve'
|
||||
import { tryNodeResolve } from './plugins/resolve'
|
||||
import {
|
||||
@@ -9,8 +11,6 @@ import {
|
||||
isBuiltin,
|
||||
isInNodeModules,
|
||||
} from './utils'
|
||||
import type { Environment } from './environment'
|
||||
import type { PartialEnvironment } from './baseEnvironment'
|
||||
|
||||
const debug = createDebugger('vite:external')
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import fsp from 'node:fs/promises'
|
||||
import net from 'node:net'
|
||||
import path from 'node:path'
|
||||
import type { OutgoingHttpHeaders as HttpServerHeaders } from 'node:http'
|
||||
import type { ServerOptions as HttpsServerOptions } from 'node:https'
|
||||
import net from 'node:net'
|
||||
import path from 'node:path'
|
||||
import colors from 'picocolors'
|
||||
import type { Connect } from '#dep-types/connect'
|
||||
import type { ProxyOptions } from './server/middlewares/proxy'
|
||||
import { wildcardHosts } from './constants'
|
||||
import type { Logger } from './logger'
|
||||
import type { HttpServer } from './server'
|
||||
import { wildcardHosts } from './constants'
|
||||
import type { ProxyOptions } from './server/middlewares/proxy'
|
||||
|
||||
export interface CommonServerOptions {
|
||||
/**
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import type { PartialResolvedId } from 'rolldown'
|
||||
import aliasPlugin from '@rollup/plugin-alias'
|
||||
import type { PartialResolvedId } from 'rolldown'
|
||||
import type { PartialEnvironment } from './baseEnvironment'
|
||||
import type { ResolvedConfig } from './config'
|
||||
import type { EnvironmentPluginContainer } from './server/pluginContainer'
|
||||
import { createEnvironmentPluginContainer } from './server/pluginContainer'
|
||||
import type { Environment } from './environment'
|
||||
import { oxcResolvePlugin } from './plugins/resolve'
|
||||
import type { InternalResolveOptions } from './plugins/resolve'
|
||||
import type { Environment } from './environment'
|
||||
import type { PartialEnvironment } from './baseEnvironment'
|
||||
import type { EnvironmentPluginContainer } from './server/pluginContainer'
|
||||
import { createEnvironmentPluginContainer } from './server/pluginContainer'
|
||||
|
||||
export type ResolveIdFn = (
|
||||
environment: PartialEnvironment,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import path from 'node:path'
|
||||
import { walk as eswalk } from 'estree-walker'
|
||||
import { analyze } from 'periscopic'
|
||||
import colors from 'picocolors'
|
||||
import type { Plugin } from 'rolldown'
|
||||
import { walk as eswalk } from 'estree-walker'
|
||||
import { parseSync, type ESTree } from 'rolldown/utils'
|
||||
import { analyze } from 'periscopic'
|
||||
import { isFilePathESM, normalizePath, numberToPos } from './utils'
|
||||
|
||||
export type NativeConfigIncompatibilityType =
|
||||
|
||||
@@ -1,20 +1,27 @@
|
||||
import fs from 'node:fs'
|
||||
import fsp from 'node:fs/promises'
|
||||
import path from 'node:path'
|
||||
import { promisify } from 'node:util'
|
||||
import { performance } from 'node:perf_hooks'
|
||||
import { promisify } from 'node:util'
|
||||
import { ignoreInput, ignoreOutput } from '@voidzero-dev/vite-task-client'
|
||||
import colors from 'picocolors'
|
||||
import { init, parse } from 'es-module-lexer'
|
||||
import { isDynamicPattern } from 'tinyglobby'
|
||||
import colors from 'picocolors'
|
||||
import {
|
||||
type RolldownOptions,
|
||||
type RolldownOutput,
|
||||
type OutputOptions as RolldownOutputOptions,
|
||||
rolldown,
|
||||
} from 'rolldown'
|
||||
import { isDynamicPattern } from 'tinyglobby'
|
||||
import type { DepsOptimizerEsbuildOptions } from '#types/internal/esbuildOptions'
|
||||
import { isWindows } from '../../shared/utils'
|
||||
import type { ResolvedConfig } from '../config'
|
||||
import {
|
||||
ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET,
|
||||
METADATA_FILENAME,
|
||||
} from '../constants'
|
||||
import type { Environment } from '../environment'
|
||||
import { transformWithOxc } from '../plugins/oxc'
|
||||
import {
|
||||
arraify,
|
||||
asyncFlatten,
|
||||
@@ -29,19 +36,12 @@ import {
|
||||
tryStatSync,
|
||||
unique,
|
||||
} from '../utils'
|
||||
import {
|
||||
ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET,
|
||||
METADATA_FILENAME,
|
||||
} from '../constants'
|
||||
import { isWindows } from '../../shared/utils'
|
||||
import type { Environment } from '../environment'
|
||||
import { transformWithOxc } from '../plugins/oxc'
|
||||
import { ScanEnvironment, scanImports } from './scan'
|
||||
import { createOptimizeDepsIncludeResolver, expandGlobIds } from './resolve'
|
||||
import {
|
||||
rolldownCjsExternalPlugin,
|
||||
rolldownDepPlugin,
|
||||
} from './rolldownDepPlugin'
|
||||
import { ScanEnvironment, scanImports } from './scan'
|
||||
|
||||
const debug = createDebugger('vite:deps')
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import colors from 'picocolors'
|
||||
import { createDebugger, getHash } from '../utils'
|
||||
import {
|
||||
type PromiseWithResolvers,
|
||||
promiseWithResolvers,
|
||||
} from '../../shared/utils'
|
||||
import type { DevEnvironment } from '../server/environment'
|
||||
import { createDebugger, getHash } from '../utils'
|
||||
import { devToScanEnvironment } from './scan'
|
||||
import {
|
||||
addManuallyIncludedOptimizeDeps,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import path from 'node:path'
|
||||
import picomatch from 'picomatch'
|
||||
import { globSync } from 'tinyglobby'
|
||||
import type { ResolvedConfig } from '../config'
|
||||
import { escapeRegex, getNpmPackageName } from '../utils'
|
||||
import { resolvePackageData } from '../packages'
|
||||
import { slash } from '../../shared/utils'
|
||||
import type { ResolvedConfig } from '../config'
|
||||
import type { Environment } from '../environment'
|
||||
import { createBackCompatIdResolver } from '../idResolver'
|
||||
import { resolvePackageData } from '../packages'
|
||||
import { escapeRegex, getNpmPackageName } from '../utils'
|
||||
|
||||
export function createOptimizeDepsIncludeResolver(
|
||||
environment: Environment,
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
import path from 'node:path'
|
||||
import MagicString from 'magic-string'
|
||||
import type { ImportKind, Plugin, RolldownPlugin } from 'rolldown'
|
||||
import { prefixRegex } from 'rolldown/filter'
|
||||
import MagicString from 'magic-string'
|
||||
import { stripLiteral } from 'strip-literal'
|
||||
import { isWindows } from '../../shared/utils'
|
||||
import { JS_TYPES_RE, KNOWN_ASSET_TYPES } from '../constants'
|
||||
import type { Environment } from '../environment'
|
||||
import { createBackCompatIdResolver } from '../idResolver'
|
||||
import type { PackageCache } from '../packages'
|
||||
import { assetImportMetaUrlRE } from '../plugins/assetImportMetaUrl'
|
||||
import { isModuleCSSRequest } from '../plugins/css'
|
||||
import { hasViteIgnoreRE } from '../plugins/importAnalysis'
|
||||
import { browserExternalId, optionalPeerDepId } from '../plugins/resolve'
|
||||
import {
|
||||
escapeRegex,
|
||||
flattenId,
|
||||
@@ -16,13 +23,6 @@ import {
|
||||
moduleListContains,
|
||||
normalizePath,
|
||||
} from '../utils'
|
||||
import { browserExternalId, optionalPeerDepId } from '../plugins/resolve'
|
||||
import { isModuleCSSRequest } from '../plugins/css'
|
||||
import type { Environment } from '../environment'
|
||||
import { createBackCompatIdResolver } from '../idResolver'
|
||||
import { isWindows } from '../../shared/utils'
|
||||
import { hasViteIgnoreRE } from '../plugins/importAnalysis'
|
||||
import { assetImportMetaUrlRE } from '../plugins/assetImportMetaUrl'
|
||||
|
||||
const externalWithConversionNamespace =
|
||||
'vite:dep-pre-bundle:external-conversion'
|
||||
|
||||
@@ -2,18 +2,28 @@ import fs from 'node:fs'
|
||||
import fsp from 'node:fs/promises'
|
||||
import path from 'node:path'
|
||||
import { performance } from 'node:perf_hooks'
|
||||
import colors from 'picocolors'
|
||||
import type { PartialResolvedId, Plugin } from 'rolldown'
|
||||
import { scan } from 'rolldown/experimental'
|
||||
import type { TransformOptions as OxcTransformOptions } from 'rolldown/utils'
|
||||
import { transformSync } from 'rolldown/utils'
|
||||
import type { PartialResolvedId, Plugin } from 'rolldown'
|
||||
import colors from 'picocolors'
|
||||
import { glob } from 'tinyglobby'
|
||||
import { cleanUrl } from '../../shared/utils'
|
||||
import { BaseEnvironment } from '../baseEnvironment'
|
||||
import {
|
||||
CSS_LANGS_RE,
|
||||
JS_TYPES_RE,
|
||||
KNOWN_ASSET_TYPES,
|
||||
SPECIAL_QUERY_RE,
|
||||
} from '../constants'
|
||||
import { transformGlobImport } from '../plugins/importMetaGlob'
|
||||
import { getRollupJsxPresets } from '../plugins/oxc'
|
||||
import type { DevEnvironment } from '../server/environment'
|
||||
import type { EnvironmentPluginContainer } from '../server/pluginContainer'
|
||||
import {
|
||||
ERR_CLOSED_SERVER,
|
||||
createEnvironmentPluginContainer,
|
||||
} from '../server/pluginContainer'
|
||||
import {
|
||||
arraify,
|
||||
asyncFlatten,
|
||||
@@ -31,16 +41,6 @@ import {
|
||||
virtualModulePrefix,
|
||||
virtualModuleRE,
|
||||
} from '../utils'
|
||||
import type { EnvironmentPluginContainer } from '../server/pluginContainer'
|
||||
import {
|
||||
ERR_CLOSED_SERVER,
|
||||
createEnvironmentPluginContainer,
|
||||
} from '../server/pluginContainer'
|
||||
import { BaseEnvironment } from '../baseEnvironment'
|
||||
import type { DevEnvironment } from '../server/environment'
|
||||
import { transformGlobImport } from '../plugins/importMetaGlob'
|
||||
import { cleanUrl } from '../../shared/utils'
|
||||
import { getRollupJsxPresets } from '../plugins/oxc'
|
||||
|
||||
export class ScanEnvironment extends BaseEnvironment {
|
||||
mode = 'scan' as const
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import { createRequire } from 'node:module'
|
||||
import path from 'node:path'
|
||||
import type { Plugin } from './plugin'
|
||||
import type { InternalResolveOptions } from './plugins/resolve'
|
||||
import {
|
||||
createFilter,
|
||||
isInNodeModules,
|
||||
@@ -9,8 +11,6 @@ import {
|
||||
stripBomTag,
|
||||
tryStatSync,
|
||||
} from './utils'
|
||||
import type { Plugin } from './plugin'
|
||||
import type { InternalResolveOptions } from './plugins/resolve'
|
||||
|
||||
let pnp: typeof import('pnpapi') | undefined
|
||||
if (process.versions.pnp) {
|
||||
|
||||
@@ -13,24 +13,24 @@ import type {
|
||||
TransformPluginContext,
|
||||
TransformResult,
|
||||
} from 'rolldown'
|
||||
import type { PartialEnvironment } from './baseEnvironment'
|
||||
import type { BuildAppHook } from './build'
|
||||
import type {
|
||||
ConfigEnv,
|
||||
EnvironmentOptions,
|
||||
ResolvedConfig,
|
||||
UserConfig,
|
||||
} from './config'
|
||||
import type { CloseServerHook, ServerHook } from './server'
|
||||
import type { BuildAppHook } from './build'
|
||||
import type { IndexHtmlTransform } from './plugins/html'
|
||||
import type { EnvironmentModuleNode } from './server/moduleGraph'
|
||||
import type { ModuleNode } from './server/mixedModuleGraph'
|
||||
import type { HmrContext, HotUpdateOptions } from './server/hmr'
|
||||
import type { DevEnvironment } from './server/environment'
|
||||
import type { Environment } from './environment'
|
||||
import type { PartialEnvironment } from './baseEnvironment'
|
||||
import type { ClosePreviewServerHook, PreviewServerHook } from './preview'
|
||||
import { arraify, asyncFlatten } from './utils'
|
||||
import type { IndexHtmlTransform } from './plugins/html'
|
||||
import type { StringFilter } from './plugins/pluginFilter'
|
||||
import type { ClosePreviewServerHook, PreviewServerHook } from './preview'
|
||||
import type { CloseServerHook, ServerHook } from './server'
|
||||
import type { DevEnvironment } from './server/environment'
|
||||
import type { HmrContext, HotUpdateOptions } from './server/hmr'
|
||||
import type { ModuleNode } from './server/mixedModuleGraph'
|
||||
import type { EnvironmentModuleNode } from './server/moduleGraph'
|
||||
import { arraify, asyncFlatten } from './utils'
|
||||
|
||||
/**
|
||||
* Vite plugins extends the Rollup plugin interface with a few extra
|
||||
|
||||
@@ -1,24 +1,36 @@
|
||||
import path from 'node:path'
|
||||
import fsp from 'node:fs/promises'
|
||||
import { Buffer } from 'node:buffer'
|
||||
import { randomBytes } from 'node:crypto'
|
||||
import fsp from 'node:fs/promises'
|
||||
import path from 'node:path'
|
||||
import { pathToFileURL } from 'node:url'
|
||||
import MagicString from 'magic-string'
|
||||
import * as mrmime from 'mrmime'
|
||||
import colors from 'picocolors'
|
||||
import picomatch from 'picomatch'
|
||||
import type {
|
||||
NormalizedOutputOptions,
|
||||
PluginContext,
|
||||
RenderedChunk,
|
||||
} from 'rolldown'
|
||||
import MagicString from 'magic-string'
|
||||
import colors from 'picocolors'
|
||||
import picomatch from 'picomatch'
|
||||
import { makeIdFiltersToMatchWithQuery } from 'rolldown/filter'
|
||||
import {
|
||||
cleanUrl,
|
||||
splitFileAndPostfix,
|
||||
withTrailingSlash,
|
||||
} from '../../shared/utils'
|
||||
import type { PartialEnvironment } from '../baseEnvironment'
|
||||
import {
|
||||
createToImportMetaURLBasedRelativeRuntime,
|
||||
toOutputFilePathInJS,
|
||||
} from '../build'
|
||||
import type { Plugin } from '../plugin'
|
||||
import type { ResolvedConfig } from '../config'
|
||||
import {
|
||||
DEFAULT_ASSETS_INLINE_LIMIT,
|
||||
DEFAULT_ASSETS_RE,
|
||||
FS_PREFIX,
|
||||
} from '../constants'
|
||||
import type { Environment } from '../environment'
|
||||
import type { Plugin } from '../plugin'
|
||||
import { checkPublicFile } from '../publicDir'
|
||||
import {
|
||||
encodeURIPath,
|
||||
@@ -31,18 +43,6 @@ import {
|
||||
removeUrlQuery,
|
||||
urlRE,
|
||||
} from '../utils'
|
||||
import {
|
||||
DEFAULT_ASSETS_INLINE_LIMIT,
|
||||
DEFAULT_ASSETS_RE,
|
||||
FS_PREFIX,
|
||||
} from '../constants'
|
||||
import {
|
||||
cleanUrl,
|
||||
splitFileAndPostfix,
|
||||
withTrailingSlash,
|
||||
} from '../../shared/utils'
|
||||
import type { Environment } from '../environment'
|
||||
import type { PartialEnvironment } from '../baseEnvironment'
|
||||
import { getImportMapFilename } from './html'
|
||||
|
||||
// referenceId is base64url but replaces - with $
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
import path from 'node:path'
|
||||
import MagicString from 'magic-string'
|
||||
import { stripLiteral } from 'strip-literal'
|
||||
import { exactRegex } from 'rolldown/filter'
|
||||
import type { Plugin } from '../plugin'
|
||||
import { stripLiteral } from 'strip-literal'
|
||||
import { slash } from '../../shared/utils'
|
||||
import type { ResolvedConfig } from '../config'
|
||||
import { CLIENT_ENTRY } from '../constants'
|
||||
import { createBackCompatIdResolver } from '../idResolver'
|
||||
import type { ResolveIdFn } from '../idResolver'
|
||||
import type { Plugin } from '../plugin'
|
||||
import {
|
||||
injectQuery,
|
||||
isDataUrl,
|
||||
@@ -11,15 +15,11 @@ import {
|
||||
transformStableResult,
|
||||
tryStatSync,
|
||||
} from '../utils'
|
||||
import { CLIENT_ENTRY } from '../constants'
|
||||
import { slash } from '../../shared/utils'
|
||||
import { createBackCompatIdResolver } from '../idResolver'
|
||||
import type { ResolveIdFn } from '../idResolver'
|
||||
import { fileToUrl } from './asset'
|
||||
import { hasViteIgnoreRE } from './importAnalysis'
|
||||
import { preloadHelperId } from './importAnalysisBuild'
|
||||
import type { InternalResolveOptions } from './resolve'
|
||||
import { tryFsResolve } from './resolve'
|
||||
import { hasViteIgnoreRE } from './importAnalysis'
|
||||
|
||||
/**
|
||||
* Convert `new URL('./foo.png', import.meta.url)` to its resolved built URL
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import path from 'node:path'
|
||||
import fs from 'node:fs'
|
||||
import type { Plugin } from '../plugin'
|
||||
import path from 'node:path'
|
||||
import { cleanUrl } from '../../shared/utils'
|
||||
import type { ResolvedConfig } from '../config'
|
||||
import { CLIENT_ENTRY, ENV_ENTRY, BUNDLED_DEV_CLIENT_ENTRY } from '../constants'
|
||||
import { isObject, normalizePath, resolveHostname } from '../utils'
|
||||
import { cleanUrl } from '../../shared/utils'
|
||||
import { perEnvironmentState } from '../environment'
|
||||
import type { Plugin } from '../plugin'
|
||||
import { isObject, normalizePath, resolveHostname } from '../utils'
|
||||
import { replaceDefine, serializeDefine } from './define'
|
||||
|
||||
// ids in transform are normalized to unix style
|
||||
|
||||
Loaded 100 of 246 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user