refactor: use # prefex for internal aliases

leftovers
This commit is contained in:
Pooya Parsa 2021-06-18 11:54:35 +02:00
parent 98a0c727c9
commit 3398d5a7d6
16 changed files with 18 additions and 18 deletions

View File

@ -189,7 +189,7 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
// Polyfill
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

View File

@ -12,7 +12,7 @@ export function middleware (getMiddleware: () => ServerMiddleware[]) {
let lastDump = ''
return virtual({
'~serverMiddleware': {
'#server-middleware': {
load: () => {
const middleware = getMiddleware()

View File

@ -28,11 +28,11 @@ export function staticAssets (context: NitroContext) {
}
return virtual({
'~static-assets': `export default ${JSON.stringify(assets, null, 2)};`,
'~static': `
'#static-assets': `export default ${JSON.stringify(assets, null, 2)};`,
'#static': `
import { promises } from 'fs'
import { resolve } from 'path'
import assets from '~static-assets'
import assets from '#static-assets'
export function readAsset (id) {
return promises.readFile(resolve(mainDir, getAsset(id).path))

View File

@ -1,4 +1,4 @@
import '~polyfill'
import '#polyfill'
import { parseURL } from 'ufo'
import { localCall } from '../server'

View File

@ -1,4 +1,4 @@
import '~polyfill'
import '#polyfill'
import { localCall } from '../server'
export default async function handle (context, req) {

View File

@ -1,4 +1,4 @@
import '~polyfill'
import '#polyfill'
import { localCall } from '../server'
async function cli () {

View File

@ -1,4 +1,4 @@
import '~polyfill'
import '#polyfill'
import { getAssetFromKV } from '@cloudflare/kv-asset-handler'
import { localCall } from '../server'

View File

@ -1,4 +1,4 @@
import '~polyfill'
import '#polyfill'
import { Server } from 'http'
import { parentPort } from 'worker_threads'
import type { AddressInfo } from 'net'

View File

@ -1,4 +1,4 @@
import '~polyfill'
import '#polyfill'
import { handle } from '../server'

View File

@ -1,4 +1,4 @@
import '~polyfill'
import '#polyfill'
import { withQuery } from 'ufo'
import { localCall } from '../server'

View File

@ -1,2 +1,2 @@
import '~polyfill'
import '#polyfill'
export * from '../server'

View File

@ -1,4 +1,4 @@
import '~polyfill'
import '#polyfill'
import { Server } from 'http'
import destr from 'destr'
import { handle } from '../server'

View File

@ -1,5 +1,5 @@
// @ts-nocheck
import '~polyfill'
import '#polyfill'
import { localCall } from '../server'
addEventListener('fetch', (event: any) => {

View File

@ -1,4 +1,4 @@
import '~polyfill'
import '#polyfill'
import { handle } from '../server'
export default handle

View File

@ -6,7 +6,7 @@ import { createCall, createFetch as createLocalFetch } from 'unenv/runtime/fetch
import { timingMiddleware } from './timing'
import { handleError } from './error'
// @ts-ignore
import serverMiddleware from '~serverMiddleware'
import serverMiddleware from '#server-middleware'
const app = createApp({
debug: destr(process.env.DEBUG),

View File

@ -1,7 +1,7 @@
import { createError } from 'h3'
import { withoutTrailingSlash, withLeadingSlash, parseURL } from 'ufo'
// @ts-ignore
import { getAsset, readAsset } from '~static'
import { getAsset, readAsset } from '#static'
const METHODS = ['HEAD', 'GET']
const PUBLIC_PATH = process.env.PUBLIC_PATH // Default: /_nuxt/