// npm package
jest-less-loader
Jest transformer for .less file.
versions
5
maintainers
2
license
MIT
first publish
2019-12-06
publisher
wjgogogo
tarball
5,845 B
AUTO-PUBLISHED·1 version indexed·latest published 2023-01-09
// offending code· @0.2.0· no static-pattern hits
llm: benign · 0.85→ No suspicious destination, no remote-exec shape — 1 known-vendor host(s).
- @0.2.0··AUTO-PUBLISHED·publisher: wjgogogoheuristic 75/100static flags 0llm benign (0.85) via ollamarecent-owner-changedormant-takeover:prev=atool@0.1.2osv-flagged:MAL-2026-4140
→ No suspicious destination, no remote-exec shape — 1 known-vendor host(s).
// offending code· no static-pattern hits
--- install scripts --- ### prepublishOnly npm run build --- package.json (entry) --- { "name": "jest-less-loader", "version": "0.2.0", "description": "Jest transformer for .less file.", "license": "MIT", "main": "lib/index.js", "files": [ "lib" ], "scripts": { "clean": "rimraf -rf lib", "lint": "eslint src/**/*.ts __tests__/**/*.ts", "lint-staged": "lint-staged", "test": "jest --no-cache", "ci": "npm run lint && npm run test && lint-md .", "start": "tsc -w", "build": "rimraf ./lib && tsc --module commonjs --outDir lib", "prepublishOnly": "npm run build" }, "dependencies": {}, "peerDependencies": { "less": "^4.1.3" }, "keywords": [ "jest", "less", "transformer" ], "devDependencies": { "@commitlint/cli": "^8.2.0", "@types/jest": "^24.0.18", "@types/node": "^12.12.14", "@typescript-eslint/eslint-plugin": "^2.3.1", "@typescript-eslint/parser": "^2.3.1", "eslint": "^6.4.0", "eslint-config-prettier": "^6.3.0", "husky": "^3.0.5", "jest": "^24.9.0", "jest-electron": "^0.1.7", "less": "^4.1.3", "lint-md-cli": "^0.1.1", "lint-staged": "^9.3.0", "prettier": "^1.18.2", "rimraf": "^3.0.0", "ts-jest": "^24.1.0", "typescript": "^3.6 --- index.js (entry) --- "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var less_1 = __importDefault(require("less")); /** * transform less sync * @param fileContent * @param filePath */ function transformLess(fileContent, filePath) { var data = fileContent.replace(/^\uFEFF/, ''); // handle with fileContent include @import url // paths used for search less file from node_modules, such as `@import '@lib/index.less'` var options = { sync: true, syncImport: true, relativeUrls: true, filename: filePath, paths: ['node_modules'] }; var css = ''; less_1.default.render(data, options, function (err, result) { if (err) throw err; css = result.css; }); return css; } /** * inject style css into header * @param css */ function injectStyle(css) { var head = document.getElementsByTagName('head')[0]; var style = document.createElement('style'); style.type = 'text/css'; style.appendChild(document.createTextNode(css)); head.appendChild(style); } /** * the transformer entr
