MCPcopy
hub / github.com/nuxt/nuxt / transform

Function transform

packages/nuxt/test/unctx-transform.test.ts:55–67  ·  view source on GitHub ↗
(code: string, id = 'app.vue')

Source from the content-addressed store, hash-verified

53})
54
55function transform (code: string, id = 'app.vue') {
56 const transformerOptions = {
57 helperModule: 'unctx',
58 asyncFunctions: ['defineNuxtPlugin', 'defineNuxtRouteMiddleware'],
59 objectDefinitions: {
60 defineNuxtComponent: ['asyncData', 'setup'],
61 defineNuxtPlugin: ['setup'],
62 definePageMeta: ['middleware', 'validate'],
63 },
64 }
65 const plugin = UnctxTransformPlugin({ sourcemap: false, transformerOptions }).raw({}, {} as any) as any
66 return plugin.transformInclude(id) ? Promise.resolve(plugin.transform.handler(code)).then((r: any) => r?.code.replace(/^ {6}/gm, '').trim()) : null
67}

Callers 1

Calls 2

UnctxTransformPluginFunction · 0.90
resolveMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…