MCPcopy Create free account
hub / github.com/solidjs/solid-start / Program

Function Program

packages/start/src/directives/plugin.ts:355–386  ·  view source on GitHub ↗
(program, ctx)

Source from the content-addressed store, hash-verified

353 name: "solid-start:directives",
354 visitor: {
355 Program(program, ctx) {
356 const isModuleLevel = isDirectiveValid(ctx.opts, program.node.directives);
357 if (isModuleLevel) {
358 transformModuleLevelDirective(ctx.opts, program);
359 ctx.opts.valid = true;
360 } else {
361 // First, bubble up function declarations
362 program.traverse({
363 FunctionDeclaration(child) {
364 // if (isFunctionDirectiveValid(ctx.opts, child)) {
365 bubbleFunctionDeclaration(child);
366 // }
367 },
368 });
369 program.scope.crawl();
370 // Now we transform each function
371 program.traverse({
372 ArrowFunctionExpression(path) {
373 transformFunction(ctx.opts, path, false);
374 },
375 FunctionExpression(path) {
376 transformFunction(ctx.opts, path, false);
377 },
378 });
379 program.scope.crawl();
380
381 if (ctx.opts.count > 0) {
382 ctx.opts.valid = true;
383 removeUnusedVariables(program);
384 }
385 }
386 },
387 },
388 };
389}

Callers

nothing calls this directly

Calls 3

removeUnusedVariablesFunction · 0.90
isDirectiveValidFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…