MCPcopy
hub / github.com/vuejs/core / registerUserImport

Function registerUserImport

packages/compiler-sfc/src/compileScript.ts:251–280  ·  view source on GitHub ↗
(
    source: string,
    local: string,
    imported: string,
    isType: boolean,
    isFromSetup: boolean,
    needTemplateUsageCheck: boolean,
  )

Source from the content-addressed store, hash-verified

249 }
250
251 function registerUserImport(
252 source: string,
253 local: string,
254 imported: string,
255 isType: boolean,
256 isFromSetup: boolean,
257 needTemplateUsageCheck: boolean,
258 ) {
259 // template usage check is only needed in non-inline mode, so we can skip
260 // the work if inlineTemplate is true.
261 let isUsedInTemplate = needTemplateUsageCheck
262 if (
263 needTemplateUsageCheck &&
264 ctx.isTS &&
265 sfc.template &&
266 !sfc.template.src &&
267 !sfc.template.lang
268 ) {
269 isUsedInTemplate = isImportUsed(local, sfc)
270 }
271
272 ctx.userImports[local] = {
273 isType,
274 imported,
275 local,
276 source,
277 isFromSetup,
278 isUsedInTemplate,
279 }
280 }
281
282 function checkInvalidScopeReference(node: Node | undefined, method: string) {
283 if (!node) return

Callers 1

compileScriptFunction · 0.85

Calls 1

isImportUsedFunction · 0.90

Tested by

no test coverage detected