Languages
Language support for jsrepo.
jsrepo uses languages to determine the dependencies of registry items when you run the build command and also how to add and install dependencies.
jsrepo can distribute code of any language or file type but these are the languages that support dependency resolution.
Available Languages
By default jsrepo supports the following languages:
JavaScript
Support for *.js, *.ts, *.jsx, *.tsx, *.mjs, *.mts files.
Svelte
Support for *.svelte files.
Vue
Support for *.vue files.
CSS
Support for *.css, *.scss, *.sass files.
HTML
Support for *.html files.
What is dependency resolution?
Dependency resolution is the process of determining the dependencies of a registry item. This process ensures that when you add a registry item that all of it's dependencies are also added.
Without dependency resolution you need to manually specify dependencies of a registry item which is cumbersome and error prone.
How to manually specify dependencies
If your language of choice doesn't support dependency resolution or your registry items have dependencies that cannot be automatically detected you can manually specify them like so:
import { defineConfig } from "jsrepo";
import { js } from "jsrepo/langs";
export default defineConfig({
registry: {
items: [
{
name: "button",
type: "component",
files: [
{
path: "src/components/button.tsx",
},
],
registryDependencies: ["utils"],
remoteDependencies: [
{
ecosystem: "js",
name: "radix-ui",
version: "1.4.3",
},
],
},
],
},
});How to prevent automatic dependency resolution
If you want to opt out of automatic dependency resolution you can do so by setting the dependencyResolution option to manual on the registry item or on the file itself.
import { defineConfig } from "jsrepo";
import { js } from "jsrepo/langs";
export default defineConfig({
registry: {
items: [
{
name: "button",
type: "component",
// for the entire item
dependencyResolution: "manual",
files: [
{
path: "src/components/button.tsx",
// for individual files
dependencyResolution: "manual",
},
],
},
],
},
});Strict mode
By default jsrepo will error if it cannot resolve all dependencies of a registry item. You can opt out of this behavior by setting the strict option to false.
import { defineConfig } from "jsrepo";
import { js } from "jsrepo/langs";
export default defineConfig({
registry: {
items: [
{
name: "button",
type: "component",
strict: false,
},
],
},
});