Socket
Book a DemoInstallSign in
Socket

@swanide/component-parser

Package Overview
Dependencies
Maintainers
4
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swanide/component-parser

parse swan component

0.2.2
latest
npmnpm
Version published
Weekly downloads
0
Maintainers
4
Weekly downloads
 
Created
Source

@swanide/component-parser

使用 Rust + swc 解析小程序 Page,Component 组件中的变量信息,给代码提示模块使用,多文件解析下,性能大概是 acorn 的 10 倍。

使用 Rust 解析 css 类名,支持 @import 多文件并行解析。

使用方法:

import {parseFiles, parseFile, parseCss, parseCssFiles} from '@swanide/component-parser';

// 解析 script meta
const filePaths = [
    'test/fixtures/page.js',
    'test/fixtures/component.js'
];
// 解析多个文件
const result = parseFiles(filePaths);
console.log(result);
// 解析单个文件
const result = parseFile('test/fixtures/page.js');
console.log(result);

// 解析 css meta
const cssFiles = [
    'test/fixtures/page.css',
    'test/fixtures/component.css'
];
// 解析多个文件,注意返回的 map 中包含所有被 import 的 css 文件
const result = parseCssFiles(cssFiles);
console.log(result);
// 解析单个文件
const result = parseCss('test/fixtures/page.css');
console.log(result);

操作系统

最低操作系统版本要求如下,其他操作系统版本会自动走 mock:

  • windows 10
  • macOS Mojave

FAQs

Package last updated on 16 Feb 2023

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.