class

Analyzer::Javascript::QwikCity

Inherits Analyzer::Javascript::JavascriptEngine < Analyzer < FileHelper < Reference < Object

Qwik City routes by directory: only index.* modules under src/routes/ become routes, at their directory's path.

src/routes/index.tsx → GET / src/routes/about/index.tsx → GET /about src/routes/(auth)/login/index.tsx → GET /login (group hidden) src/routes/users/[id]/index.tsx → GET /users/{id} src/routes/docs/[...rest]/index.md → GET /docs/{rest} src/routes/api/users/index.ts → its onGet / onPost / ... exports

A default export is the page (GET), an exported routeAction$ (or modular-forms formAction$) posts back to the page (POST), and onRequest alone answers every verb. layout.*, plugin.* and every other module in the tree add no route.

Constants

EXTENSIONS = [".tsx", ".jsx", ".ts", ".js", ".md", ".mdx"]
INDEX_LEAF = /\Aindex(?:@[\w-]+)?\.\w+\z/
ON_REQUEST = /export\s+(?:const|let|var|(?:async\s+)?function)\s+onRequest\b/
PACKAGE_MARKERS = ["\"@builder.io/qwik-city\"", "\"@qwik.dev/router\""]
ROUTE_ACTION = /export\s+const\s+\w+\s*=\s*(?:routeAction|formAction)\$\s*\(/
VERB_EXPORT_RES = FILE_ROUTE_METHODS.to_h do |verb| {verb, /export\s+(?:const|let|var|(?:async\s+)?function)\s+on#{verb.capitalize}\b/} end

Class methods

tech_name
Source

Instance methods

analyze
Source
tech

Instance-side view of the same declaration. The per-file rescues live on this base class, which has no way to name the analyzer that is running inside them, so a skipped file could not be attributed to a tech. Deriving it from analyzer_for keeps the name written exactly once.

Source