esbuild-sass-plugin
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -27,3 +27,2 @@ import { OnLoadResult } from "esbuild"; | ||
export declare type CachedResult = { | ||
filename: string; | ||
type: string; | ||
@@ -30,0 +29,0 @@ mtimeMs: number; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { OnLoadResult } from "esbuild"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=options.js.map |
import { Plugin } from "esbuild"; | ||
import { SassPluginOptions } from "./index"; | ||
export declare function sassPlugin(options?: SassPluginOptions): Plugin; |
@@ -50,4 +50,3 @@ "use strict"; | ||
return [ | ||
type, | ||
(args) => importerMatcher(args.importer) && pathMatcher(path_1.resolve(args.resolveDir, args.path)) | ||
type, (args) => importerMatcher(args.importer) && pathMatcher(path_1.resolve(args.resolveDir, args.path)) | ||
]; | ||
@@ -57,4 +56,3 @@ } | ||
return [ | ||
type, | ||
(args) => importerMatcher(args.importer) | ||
type, (args) => importerMatcher(args.importer) | ||
]; | ||
@@ -129,9 +127,11 @@ } | ||
if (cached) { | ||
let { filename, type } = cached; | ||
let stats = fs_1.statSync(filename); | ||
if (stats.mtimeMs <= cached.mtimeMs) { | ||
return cached.result; | ||
let watchFiles = cached.result.watchFiles; | ||
let stats = await Promise.all(watchFiles.map(filename => fs_1.promises.stat(filename))); | ||
for (const { mtimeMs } of stats) { | ||
if (mtimeMs > cached.mtimeMs) { | ||
cached.result = await transform(watchFiles[0], cached.type); | ||
cached.mtimeMs = Date.now(); | ||
break; | ||
} | ||
} | ||
cached.result = await transform(filename, type); | ||
cached.mtimeMs = stats.mtimeMs; | ||
return cached.result; | ||
@@ -142,4 +142,3 @@ } | ||
let result = await transform(filename, type); | ||
let { mtimeMs } = fs_1.statSync(filename); | ||
group.set(args.path, { filename, type, mtimeMs, result }); | ||
group.set(args.path, { type, mtimeMs: Date.now(), result }); | ||
return result; | ||
@@ -146,0 +145,0 @@ }; |
@@ -0,0 +0,0 @@ import { SassPluginOptions } from "./index"; |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "esbuild-sass-plugin", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "esbuild plugin for sass/scss files supporting both css loader and css result import (lit-element)", | ||
@@ -55,19 +55,19 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"esbuild": "^0.12.0", | ||
"picomatch": "^2.2.2", | ||
"sass": "^1.32.8" | ||
"esbuild": "^0.12.4", | ||
"picomatch": "^2.3.0", | ||
"sass": "^1.34.0" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^4.2.15", | ||
"@types/chai": "^4.2.18", | ||
"@types/chai-string": "^1.4.2", | ||
"@types/mocha": "^8.2.2", | ||
"@types/node": "^15.0.1", | ||
"@types/node": "^15.6.1", | ||
"@types/sass": "^1.16.0", | ||
"chai": "^4.3.4", | ||
"chai-string": "^1.5.0", | ||
"mocha": "^8.3.2", | ||
"mocha": "^8.4.0", | ||
"nyc": "^15.1.0", | ||
"ts-node": "^9.1.1", | ||
"typescript": "^4.2.3" | ||
"ts-node": "^10.0.0", | ||
"typescript": "^4.3.2" | ||
} | ||
} |
@@ -0,0 +0,0 @@  |
@@ -141,4 +141,2 @@ import {OnLoadResult} from "esbuild"; | ||
filename: string | ||
type: string | ||
@@ -152,2 +150,2 @@ | ||
export {sassPlugin} from "./plugin"; | ||
export {sassPlugin} from "./plugin"; |
import {Loader, OnLoadArgs, OnLoadResult, OnResolveArgs, Plugin} from "esbuild"; | ||
import {readFileSync, statSync} from "fs"; | ||
import {promises as fsp, readFileSync} from "fs"; | ||
import {dirname, posix, resolve} from "path"; | ||
@@ -143,9 +143,11 @@ import picomatch from "picomatch"; | ||
if (cached) { | ||
let {filename, type} = cached; | ||
let stats = statSync(filename); | ||
if (stats.mtimeMs <= cached.mtimeMs) { | ||
return cached.result; | ||
let watchFiles = cached.result.watchFiles!; | ||
let stats = await Promise.all(watchFiles.map(filename => fsp.stat(filename))); | ||
for (const {mtimeMs} of stats) { | ||
if (mtimeMs > cached.mtimeMs) { | ||
cached.result = await transform(watchFiles[0], cached.type); | ||
cached.mtimeMs = Date.now(); | ||
break; | ||
} | ||
} | ||
cached.result = await transform(filename, type); | ||
cached.mtimeMs = stats.mtimeMs; | ||
return cached.result; | ||
@@ -156,4 +158,3 @@ } | ||
let result = await transform(filename, type); | ||
let {mtimeMs} = statSync(filename); | ||
group.set(args.path, {filename, type, mtimeMs, result}); | ||
group.set(args.path, {type, mtimeMs: Date.now(), result}); | ||
return result; | ||
@@ -160,0 +161,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
40102
589
1
Updatedesbuild@^0.12.4
Updatedpicomatch@^2.3.0
Updatedsass@^1.34.0