esbuild-sass-plugin
Advanced tools
Comparing version 2.0.3 to 2.1.0
@@ -0,0 +0,0 @@ import { SassPluginOptions } from './index'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { OnLoadResult } from 'esbuild'; |
@@ -0,0 +0,0 @@ "use strict"; |
import { Plugin } from 'esbuild'; | ||
import { SassPluginOptions } from './index'; | ||
export declare function sassPlugin(options?: SassPluginOptions): Plugin; |
@@ -8,2 +8,3 @@ "use strict"; | ||
const render_1 = require("./render"); | ||
const DEFAULT_FILTER = /\.(s[ac]ss|css)$/; | ||
function sassPlugin(options = {}) { | ||
@@ -38,15 +39,11 @@ var _a; | ||
} | ||
const pluginName = 'sass-plugin'; | ||
return { | ||
name: 'sass-plugin', | ||
setup({ initialOptions, onLoad, onResolve }) { | ||
var _a, _b; | ||
const { namespace, sourcemap, watched } = (0, utils_1.getContext)(initialOptions); | ||
onResolve({ filter: (_a = options.filter) !== null && _a !== void 0 ? _a : /\.(s[ac]ss|css)$/ }, (args) => { | ||
const { resolveDir, path, importer } = args; | ||
const basedir = resolveDir || (0, path_1.dirname)(importer); | ||
return { path: resolvePath(basedir, path), namespace, pluginData: args }; | ||
}); | ||
const renderSync = (0, render_1.createRenderer)(options, (_b = options.sourceMap) !== null && _b !== void 0 ? _b : sourcemap); | ||
name: pluginName, | ||
setup({ initialOptions, onLoad }) { | ||
var _a; | ||
const { sourcemap, watched } = (0, utils_1.getContext)(initialOptions); | ||
const renderSync = (0, render_1.createRenderer)(options, sourcemap); | ||
const transform = options.transform; | ||
onLoad({ filter: /./, namespace }, (0, cache_1.useCache)(options, async (path) => { | ||
onLoad({ filter: (_a = options.filter) !== null && _a !== void 0 ? _a : DEFAULT_FILTER }, (0, cache_1.useCache)(options, async (path) => { | ||
var _a; | ||
@@ -53,0 +50,0 @@ try { |
@@ -0,0 +0,0 @@ import { SassPluginOptions } from './index'; |
@@ -137,2 +137,9 @@ "use strict"; | ||
const cssText = css.toString(); | ||
if (sourceMap) { | ||
sourceMap.sourceRoot = basedir; | ||
sourceMap.sources[sourceMap.sources.length - 1] = (0, url_1.pathToFileURL)(path).href; | ||
sourceMap.sources = sourceMap.sources.map(source => { | ||
return source.startsWith('file://') ? (0, path_1.relative)(basedir, (0, url_1.fileURLToPath)(source)) : source; | ||
}); | ||
} | ||
return { | ||
@@ -139,0 +146,0 @@ css: sourcemap ? `${cssText}\n${(0, utils_1.sourceMappingURL)(sourceMap)}` : cssText, |
@@ -0,0 +0,0 @@ import { Type } from './index'; |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "esbuild-sass-plugin", | ||
"version": "2.0.3", | ||
"version": "2.1.0", | ||
"description": "esbuild plugin for sass/scss files supporting both css loader and css result import (lit-element)", | ||
@@ -40,7 +40,7 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"esbuild": "^0.14.8", | ||
"sass": "^1.45.1" | ||
"esbuild": "^0.14.13", | ||
"sass": "^1.49.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^17.0.4", | ||
"@types/node": "^17.0.10", | ||
"@types/sass": "^1.43.1", | ||
@@ -53,4 +53,4 @@ "mocha-toolkit": "^1.0.7", | ||
"ts-node": "^10.4.0", | ||
"typescript": "^4.5.4" | ||
"typescript": "^4.5.5" | ||
} | ||
} |
@@ -17,5 +17,6 @@ ![cooltext394785080075403](https://user-images.githubusercontent.com/160981/136289874-26ce7269-ea08-47dd-be31-9bf0ef7a0b8d.png) | ||
### Breaking Changes | ||
* `type` has been simplified and now accepts only a string. If you need different types in a project you can use more | ||
than one instance of the plugin. You can have a look at the **exclude** fixture for an example_ where **lit CSS** | ||
and **CSS modules** are both used in the same app | ||
* `type` has been simplified and now accepts only a string. If you need different types in a project [you can use more | ||
than one instance](https://github.com/glromeo/esbuild-sass-plugin/issues/60) of the plugin. | ||
You can have a look at the [**multiple** fixture](https://github.com/glromeo/esbuild-sass-plugin/blob/main/test/fixture/multiple) | ||
for an example where **lit CSS** and **CSS modules** are both used in the same app | ||
* The support for [node-sass](https://github.com/sass/node-sass) has been removed and for good. | ||
@@ -22,0 +23,0 @@ Sadly, node-sass is at a dead end and so it's 1.x. I don't exclude updates or fixes on it but it's down in the list of |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
47203
19
494
278
0
Updatedesbuild@^0.14.13
Updatedsass@^1.49.0