Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lit-labs/analyzer

Package Overview
Dependencies
Maintainers
0
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lit-labs/analyzer

A static analyzer for Lit

  • 0.13.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
835
decreased by-47.25%
Maintainers
0
Weekly downloads
 
Created
Source

@lit-labs/analyzer

A static analyzer for Lit

Overview

This package contains static analysis utilities for analyzing source code that contain Lit templates and elements, that might be useful for other programs like linters, IDE plugins, code generators, etc.

This is a very early stage Lit Labs package and is not ready for use.

Usage

This section is incomplete

Node

import {createPackageAnalyzer} from '@lit-labs/analyzer/package-analyzer.js';
import * as path from 'path';

const packagePath = path.resolve('./my-package');
const analyzer = createPackageAnalyzer(packagePath);
const module = analyzer.getModule(
  path.resolve(packagePath, 'src/my-element.ts')
);

Browser

You must use a bundler to bundle TypeScript, such as Rollup with the CommonJS plugin.

With @rollup/plugin-commonjs you need to ignore built-in libraries like os, fs, etc. You can isgnore these in your Rollup config:

rollup.config.js:

import commonjs from '@rollup/plugin-commonjs';

// ...
    plugins: [
      commonjs({
          ignore: (id) => ['fs', 'os', 'inspector'].includes(id),
      }),
    ],
// ...

You may need to install the 'path' package:

npm i path

Then you can make an Analyzer using these imports:

import {Analyzer} from '@lit-labs/analyzer/lib/analyzer.js';
import {AbsolutePath} from '@lit-labs/analyzer/lib/paths.js';
import ts from 'typescript';
import * as path from 'path';

// TODO: show constructing an Analyzer in browser contexts

Contributing

Please see CONTRIBUTING.md.

FAQs

Package last updated on 07 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc