Reference › Project
clarusjs 0.4.0
All releases · [email protected] on npm
Minor Changes
clarusjs check [--json] [dir]: type-checks every.tsclfile undersrc/(and the TypeScript they use) with the project's TypeScript and reports each error atfile.tscl:line:col, including template syntax errors. Extends the project'stsconfig.json; exits with 1 when there are errors. The command line is built oncommander(zero dependencies, Node only, never in browser bundles). #76- Data imports in templates:
@import { a, b } from './data.ts'or@import data from './data.json'(a default import of anything that isn't a.tsclfile). In components without a script the import is server-only, so build-time data and evennode:modules stay off the browser; in islands it is bundled for the browser like a script import, andnode:imports are a build error.clarusjs checktypes the imported values. #79 clarusjs explain [route]: where each part of a built route runs, in plain words (rendered at build time, its data, each island with its size and when it attaches, JavaScript on page load and in all, CSS), read fromdist/clarusjs-manifest.json. Without a route it lists every route;--jsonprints the manifest entry. #83readManifest()fromclarusjs/manifest: a page can read the route manifest while the site is built. Pages that call it are rendered again once the manifest is written, so they show the final build; outside a build it returnsnull. #84vite buildwritesdist/clarusjs-manifest.json: for every route, its mode, its loader, the islands it renders (component, attach mode, count, gzip size) and the JavaScript and CSS it ships, with the gzip bytes that load with the page and in all. Read from the prerendered HTML and Vite's client manifest; kept outsidedist/clientso it isn't published. #82- Breaking: component files use the
.tsclextension instead of.clarus. Plain JavaScript works out of the box; types stay optional. Rename your files (for f in $(git ls-files '*.clarus'); do git mv "$f" "${f%.clarus}.tscl"; done) and the imports that name them. The Vite plugin,clarusjs checkand error locations (file.tscl:line:col) all use the new extension. #85 - Type-checking groundwork:
@import type { User } from '…'brings types into a component for its@inputdeclarations (erased from compiled output), and a generator turns each.tsclfile into virtual TypeScript (@if→ifwith narrowing,@for→for…of, components → objects typed as the child'sInputs, typed$event) with mappings back to the template, sotscerrors can be reported atfile.tscl:line:col. #75
Patch Changes
- New logo: the TSCL mark (a cut crystal flat along a T, an S-shaped lightning bolt, C and L down the stem). #86