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

@vxapp/wxss

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vxapp/wxss - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

example/dist/common.wxss

57

index.js

@@ -1,16 +0,53 @@

const fs = require('fs-extra');
const fs = require('fs');
const path = require('path');
const postcss = require('postcss');
const { promisify } = require('util');
const createResolver = require('@vxapp/resolve');
const wxss = (src, out, options = {}) => {
const { plugins = [] } = options;
const parser = postcss(plugins);
return async (input, output) => {
if(!fs.existsSync(input))
return console.error('[@vxapp/wxss] file does not exists:', input);
const source = await fs.readFile(input);
const result = await parser.process(source);
fs.writeFile(output, result.css);
const mkdir = promisify(fs.mkdir);
const exists = promisify(fs.exists);
const readFile = promisify(fs.readFile);
const writeFile = promisify(fs.writeFile);
const ensureDir = async dir => {
const paths = [];
dir.split(path.sep).reduce((prev, cur) => {
const result = path.join(prev, cur);
paths.push(result);
return result;
}, path.sep);
for(const cur of paths){
const isExists = await exists(cur);
!isExists && await mkdir(cur);
}
};
const atImport = rewriter => {
return root => {
root.walkAtRules('import', rule => {
rule.params = rewriter(JSON.parse(rule.params));
});
};
};
const wxss = options => {
const resolve = createResolver(options);
return atImport(name => {
const info = resolve(name);
wxss.compile(info);
return `"${info.relative}"`;
});
};
wxss.compile = async options => {
const { current, source, target, plugins = [] } = options;
const output = current.replace(source, target);
const content = await readFile(current);
const parse = postcss(plugins.concat(wxss(options)));
const result = parse.process(content, { from: current, to: output });
await ensureDir(path.dirname(output));
await writeFile(output, result.css);
console.log('[@vxapp/wxss] write file:', output);
};
module.exports = wxss;

5

package.json
{
"name": "@vxapp/wxss",
"version": "0.0.6",
"version": "0.0.7",
"description": "wechat mini-program wxss parser",

@@ -21,5 +21,6 @@ "keywords": [

"dependencies": {
"@vxapp/resolve": "^0.0.3",
"postcss": "^7.0.6"
},
"gitHead": "4e53073f3f30c345cf3abe8fcdb6a06ed295309f"
"gitHead": "f6034eb2cc2bbb1eca2fc31a454507a843d57008"
}

Sorry, the diff of this file is not supported yet

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