mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-19 01:45:53 +00:00
refactor: use # prefex for internal aliases
leftovers
This commit is contained in:
parent
98a0c727c9
commit
3398d5a7d6
@ -189,7 +189,7 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
|
|||||||
|
|
||||||
// Polyfill
|
// Polyfill
|
||||||
rollupConfig.plugins.push(virtual({
|
rollupConfig.plugins.push(virtual({
|
||||||
'~polyfill': env.polyfill.map(p => `import '${p}';`).join('\n')
|
'#polyfill': env.polyfill.map(p => `import '${p}';`).join('\n')
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// https://github.com/rollup/plugins/tree/master/packages/alias
|
// https://github.com/rollup/plugins/tree/master/packages/alias
|
||||||
|
@ -12,7 +12,7 @@ export function middleware (getMiddleware: () => ServerMiddleware[]) {
|
|||||||
let lastDump = ''
|
let lastDump = ''
|
||||||
|
|
||||||
return virtual({
|
return virtual({
|
||||||
'~serverMiddleware': {
|
'#server-middleware': {
|
||||||
load: () => {
|
load: () => {
|
||||||
const middleware = getMiddleware()
|
const middleware = getMiddleware()
|
||||||
|
|
||||||
|
@ -28,11 +28,11 @@ export function staticAssets (context: NitroContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return virtual({
|
return virtual({
|
||||||
'~static-assets': `export default ${JSON.stringify(assets, null, 2)};`,
|
'#static-assets': `export default ${JSON.stringify(assets, null, 2)};`,
|
||||||
'~static': `
|
'#static': `
|
||||||
import { promises } from 'fs'
|
import { promises } from 'fs'
|
||||||
import { resolve } from 'path'
|
import { resolve } from 'path'
|
||||||
import assets from '~static-assets'
|
import assets from '#static-assets'
|
||||||
|
|
||||||
export function readAsset (id) {
|
export function readAsset (id) {
|
||||||
return promises.readFile(resolve(mainDir, getAsset(id).path))
|
return promises.readFile(resolve(mainDir, getAsset(id).path))
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import '~polyfill'
|
import '#polyfill'
|
||||||
import { parseURL } from 'ufo'
|
import { parseURL } from 'ufo'
|
||||||
import { localCall } from '../server'
|
import { localCall } from '../server'
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import '~polyfill'
|
import '#polyfill'
|
||||||
import { localCall } from '../server'
|
import { localCall } from '../server'
|
||||||
|
|
||||||
export default async function handle (context, req) {
|
export default async function handle (context, req) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import '~polyfill'
|
import '#polyfill'
|
||||||
import { localCall } from '../server'
|
import { localCall } from '../server'
|
||||||
|
|
||||||
async function cli () {
|
async function cli () {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import '~polyfill'
|
import '#polyfill'
|
||||||
import { getAssetFromKV } from '@cloudflare/kv-asset-handler'
|
import { getAssetFromKV } from '@cloudflare/kv-asset-handler'
|
||||||
import { localCall } from '../server'
|
import { localCall } from '../server'
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import '~polyfill'
|
import '#polyfill'
|
||||||
import { Server } from 'http'
|
import { Server } from 'http'
|
||||||
import { parentPort } from 'worker_threads'
|
import { parentPort } from 'worker_threads'
|
||||||
import type { AddressInfo } from 'net'
|
import type { AddressInfo } from 'net'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import '~polyfill'
|
import '#polyfill'
|
||||||
|
|
||||||
import { handle } from '../server'
|
import { handle } from '../server'
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import '~polyfill'
|
import '#polyfill'
|
||||||
import { withQuery } from 'ufo'
|
import { withQuery } from 'ufo'
|
||||||
import { localCall } from '../server'
|
import { localCall } from '../server'
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
import '~polyfill'
|
import '#polyfill'
|
||||||
export * from '../server'
|
export * from '../server'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import '~polyfill'
|
import '#polyfill'
|
||||||
import { Server } from 'http'
|
import { Server } from 'http'
|
||||||
import destr from 'destr'
|
import destr from 'destr'
|
||||||
import { handle } from '../server'
|
import { handle } from '../server'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import '~polyfill'
|
import '#polyfill'
|
||||||
import { localCall } from '../server'
|
import { localCall } from '../server'
|
||||||
|
|
||||||
addEventListener('fetch', (event: any) => {
|
addEventListener('fetch', (event: any) => {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import '~polyfill'
|
import '#polyfill'
|
||||||
import { handle } from '../server'
|
import { handle } from '../server'
|
||||||
|
|
||||||
export default handle
|
export default handle
|
||||||
|
@ -6,7 +6,7 @@ import { createCall, createFetch as createLocalFetch } from 'unenv/runtime/fetch
|
|||||||
import { timingMiddleware } from './timing'
|
import { timingMiddleware } from './timing'
|
||||||
import { handleError } from './error'
|
import { handleError } from './error'
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import serverMiddleware from '~serverMiddleware'
|
import serverMiddleware from '#server-middleware'
|
||||||
|
|
||||||
const app = createApp({
|
const app = createApp({
|
||||||
debug: destr(process.env.DEBUG),
|
debug: destr(process.env.DEBUG),
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { createError } from 'h3'
|
import { createError } from 'h3'
|
||||||
import { withoutTrailingSlash, withLeadingSlash, parseURL } from 'ufo'
|
import { withoutTrailingSlash, withLeadingSlash, parseURL } from 'ufo'
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { getAsset, readAsset } from '~static'
|
import { getAsset, readAsset } from '#static'
|
||||||
|
|
||||||
const METHODS = ['HEAD', 'GET']
|
const METHODS = ['HEAD', 'GET']
|
||||||
const PUBLIC_PATH = process.env.PUBLIC_PATH // Default: /_nuxt/
|
const PUBLIC_PATH = process.env.PUBLIC_PATH // Default: /_nuxt/
|
||||||
|
Loading…
Reference in New Issue
Block a user