esbuild-plugin-less
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -1,1 +0,1 @@ | ||
var w=Object.create,m=Object.defineProperty,x=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty,L=Object.getOwnPropertyNames,C=Object.getOwnPropertyDescriptor;var h=t=>m(t,"__esModule",{value:!0});var R=(t,e)=>{for(var s in e)m(t,s,{get:e[s],enumerable:!0})},y=(t,e,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of L(e))!I.call(t,r)&&r!=="default"&&m(t,r,{get:()=>e[r],enumerable:!(s=C(e,r))||s.enumerable});return t},n=t=>y(h(m(t!=null?w(x(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);h(exports);R(exports,{lessLoader:()=>O});var c=n(require("path")),d=n(require("fs")),g=n(require("less"));var u=n(require("fs")),l=n(require("path")),F=/@import(?:\s+\((.*)\))?\s+['"](.*)['"]/,S=/@import(?:\s+\((.*)\))?\s+['"](.*)['"]/g,$=/(?:\/\*(?:[\s\S]*?)\*\/)|(\/\/(?:.*)$)/gm,D=[".css",".less"],p=t=>{try{let e=l.default.dirname(t),i=(u.default.readFileSync(t).toString("utf8").replace($,"").match(S)||[]).map(o=>o.match(F)[2]).filter(o=>!!o).map(o=>l.default.resolve(e,o));return i.reduce((o,f)=>[...o,...p(f)],i).filter(o=>D.includes(l.default.extname(o).toLowerCase()))}catch(e){return[]}};function O(t={}){return{name:"less-loader",setup:e=>{e.onResolve({filter:/\.less$/,namespace:"file"},s=>{let r=c.default.resolve(process.cwd(),c.default.relative(process.cwd(),s.resolveDir),s.path);return{path:r,watchFiles:e.initialOptions.watch?[r,...p(r)]:void 0}}),e.onLoad({filter:/\.less$/,namespace:"file"},async s=>{let r=await d.promises.readFile(s.path,"utf-8"),a=c.default.dirname(s.path),i=c.default.basename(s.path);return{contents:(await g.default.render(r,{filename:i,rootpath:a,...t,paths:[...t.paths||[],a]})).css,loader:"css",resolveDir:a}})}}}0&&(module.exports={lessLoader}); | ||
var L=Object.create,l=Object.defineProperty,w=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty,R=Object.getOwnPropertyNames,y=Object.getOwnPropertyDescriptor;var h=e=>l(e,"__esModule",{value:!0});var C=(e,t)=>{for(var s in t)l(e,s,{get:t[s],enumerable:!0})},P=(e,t,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of R(t))!I.call(e,r)&&r!=="default"&&l(e,r,{get:()=>t[r],enumerable:!(s=y(t,r))||s.enumerable});return e},c=e=>P(h(l(e!=null?L(w(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);h(exports);C(exports,{lessLoader:()=>$});var a=c(require("path")),v=c(require("fs")),x=c(require("less"));var d=c(require("fs")),m=c(require("path")),D=/@import(?:\s+\((.*)\))?\s+['"](.*)['"]/,E=/@import(?:\s+\((.*)\))?\s+['"](.*)['"]/g,F=/(?:\/\*(?:[\s\S]*?)\*\/)|(\/\/(?:.*)$)/gm,S=[".css",".less"],f=e=>{try{let t=m.default.dirname(e),i=(d.default.readFileSync(e).toString("utf8").replace(F,"").match(E)||[]).map(o=>o.match(D)[2]).filter(o=>!!o).map(o=>m.default.resolve(t,o));return i.reduce((o,u)=>[...o,...f(u)],i).filter(o=>S.includes(m.default.extname(o).toLowerCase()))}catch(t){return[]}},g=e=>{let t=e.extract.filter(r=>r),s=t.length===3?t[1]:t[0];return{text:e.message,location:{namespace:"file",file:e.filename,line:e.line,column:e.column,lineText:s}}};var $=(e={})=>({name:"less-loader",setup:t=>{t.onResolve({filter:/\.less$/,namespace:"file"},s=>{let r=a.default.resolve(process.cwd(),a.default.relative(process.cwd(),s.resolveDir),s.path);return{path:r,watchFiles:t.initialOptions.watch?[r,...f(r)]:void 0}}),t.onLoad({filter:/\.less$/,namespace:"file"},async s=>{let r=await v.promises.readFile(s.path,"utf-8"),n=a.default.dirname(s.path),i=a.default.basename(s.path);try{return{contents:(await x.default.render(r,{filename:i,rootpath:n,...e,paths:[...e.paths||[],n]})).css,loader:"css",resolveDir:n}}catch(p){return{errors:[g(p)],resolveDir:n}}})}});0&&(module.exports={lessLoader}); |
/// <reference types="less" /> | ||
import { Plugin } from 'esbuild'; | ||
/** Less-loader for esbuild */ | ||
export declare function lessLoader(options?: Less.Options): Plugin; | ||
export declare const lessLoader: (options?: Less.Options) => Plugin; |
@@ -0,2 +1,6 @@ | ||
/// <reference types="less" /> | ||
import { PartialMessage } from 'esbuild'; | ||
/** Recursively get .less/.css imports from file */ | ||
export declare const getLessImports: (filePath: string) => string[]; | ||
/** Convert less error into esbuild error */ | ||
export declare const convertLessError: (error: Less.RenderError) => PartialMessage; |
@@ -1,2 +0,2 @@ | ||
## [1.0.3](https://github.com/iam-medvedev/esbuild-plugin-less/compare/v1.0.2...v1.0.3) (2021-04-01) | ||
## [1.0.4](https://github.com/iam-medvedev/esbuild-plugin-less/compare/v1.0.3...v1.0.4) (2021-04-02) | ||
@@ -6,2 +6,2 @@ | ||
* 🐛 watch mode ([#10](https://github.com/iam-medvedev/esbuild-plugin-less/issues/10)) ([3480415](https://github.com/iam-medvedev/esbuild-plugin-less/commit/3480415f5aff20a0b4df9df02b3f1df69b945f6f)), closes [#9](https://github.com/iam-medvedev/esbuild-plugin-less/issues/9) | ||
* 🐛 better error output ([#12](https://github.com/iam-medvedev/esbuild-plugin-less/issues/12)) ([13a5026](https://github.com/iam-medvedev/esbuild-plugin-less/commit/13a5026798ede8bb714cb27b7e6267ceab4872fb)), closes [#11](https://github.com/iam-medvedev/esbuild-plugin-less/issues/11) |
{ | ||
"name": "esbuild-plugin-less", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "esbuild plugin for less files", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/iam-medvedev/esbuild-plugin-less.git", |
Sorry, the diff of this file is not supported yet
9534
23