esbuild-plugin-sass-modules
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -1,2 +0,2 @@ | ||
export default function loadStylesheet(css: string): void; | ||
export default function loadStylesheet(css: any): void; | ||
//# sourceMappingURL=loadStylesheet.d.ts.map |
@@ -6,1 +6,2 @@ export default function loadStylesheet(css) { | ||
} | ||
//# sourceMappingURL=loadStylesheet.js.map |
{ | ||
"name": "esbuild-plugin-sass-modules", | ||
"version": "0.0.1", | ||
"description": "Plugin for esbuild to support SASS styles usiing css modules.", | ||
"main": "lib/index.js", | ||
"type": "module", | ||
"version": "0.0.2", | ||
"description": "Plugin for esbuild to support SASS styles using css modules.", | ||
"main": "lib/index.mjs", | ||
"types": "lib/index.d.ts", | ||
"scripts": { | ||
"start": "tsc --watch", | ||
"build": "rm -rf lib && tsc", | ||
"build": "rimraf lib && tsc", | ||
"test": "npm run all build test:*" | ||
@@ -25,35 +24,19 @@ }, | ||
"plugin", | ||
"sass" | ||
"sass", | ||
"modules" | ||
], | ||
"dependencies": { | ||
"@ms-cloudpack/get-package": "^0.0.1", | ||
"css-tree": "^1.1.2", | ||
"fs-extra": "^9.0.1", | ||
"autoprefixer": "^10.4.0", | ||
"postcss": "^8.4.0", | ||
"postcss-modules": "^4.2.2", | ||
"sass": "^1.34.1" | ||
}, | ||
"devDependencies": { | ||
"@types/css-tree": "^1.0.5", | ||
"@types/fs-extra": "^9.0.8", | ||
"@types/node": "^14.14.35", | ||
"@types/sass": "^1.16.0", | ||
"@types/tmp": "^0.2.0", | ||
"esbuild": "^0.12.6", | ||
"husky": "^4.3.7", | ||
"lint-staged": "^10.5.3", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.2.1", | ||
"tap-spec": "^5.0.0", | ||
"tape": "^5.1.1", | ||
"typescript": "^4.2.3" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "npx lint-staged" | ||
} | ||
}, | ||
"lint-staged": { | ||
"*.js": [ | ||
"npx prettier --write" | ||
] | ||
"typescript": "^4.5.2", | ||
"jest": "27.3.1" | ||
} | ||
} |
@@ -1,16 +0,7 @@ | ||
# esbuild-plugin-sass-modules | ||
# esbuild-plugin-sass | ||
![Node.js CI](https://github.com/dzearing/esbuild-plugin-sass-modules/workflows/Node.js%20CI/badge.svg) | ||
![Node.js CI](https://github.com/koluch/esbuild-plugin-sass/workflows/Node.js%20CI/badge.svg) | ||
Plugin for [esbuild](https://esbuild.github.io/) to support SASS modules | ||
Plugin for [esbuild](https://esbuild.github.io/) to support SASS styles | ||
## What this plugin supports | ||
- Provides a default javascript-based css loader implementation. Just import css or scss in your code, and it will be loaded through Javascript. | ||
- Compiles your global .sass files into css. | ||
- Compiles your `*.module.css` files into css + class map. | ||
- Compiles your `*.module.scss` files into css + class map. | ||
- Produces .d.ts typings for modules, so that you get intellisense and build validation. | ||
- Resolves `@import '~package/path.scss'` package imports. | ||
## Install | ||
@@ -22,16 +13,2 @@ | ||
In your esbuild config: | ||
``` | ||
import sassPlugin from 'esbuild-plugin-sass-modules'; | ||
esbuild.build({ | ||
// ..., | ||
plugins: [ | ||
sassPlugin() | ||
] | ||
}) | ||
``` | ||
## Usage example | ||
@@ -52,19 +29,18 @@ | ||
```js | ||
import "./test.scss"; | ||
import './test.scss' | ||
``` | ||
Create file `build.js`: | ||
```js | ||
const esbuild = require("esbuild"); | ||
const sassPlugin = require("esbuild-plugin-sass"); | ||
const esbuild = require('esbuild'); | ||
const sassPlugin = require('esbuild-plugin-sass') | ||
esbuild | ||
.build({ | ||
entryPoints: ["src/index.js"], | ||
esbuild.build({ | ||
entryPoints: ['src/index.js'], | ||
bundle: true, | ||
outfile: "bundle.js", | ||
outfile: 'bundle.js', | ||
plugins: [sassPlugin()], | ||
}) | ||
.catch((e) => console.error(e.message)); | ||
}).catch((e) => console.error(e.message)) | ||
``` | ||
@@ -85,9 +61,1 @@ | ||
``` | ||
## Why this plugin? | ||
I built this plugin to ensure we have proper support for SASS, SASS modules, and CSS modules in one plugin. Having one plugin, rather than chaining multiple plugins together, has the benefit of reducing the amount of disk I/O and performance overhead of esbuild calling into JavaScript extraneously. | ||
- Better performance | ||
- Simplicity for the dev; no need to chain | ||
- Able to resolve sass from other packages |
Sorry, the diff of this file is not supported yet
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
5
1
12148
5
10
121
59
1
No
+ Addedautoprefixer@^10.4.0
+ Addedpostcss@^8.4.0
+ Addedpostcss-modules@^4.2.2
+ Addedautoprefixer@10.4.20(transitive)
+ Addedbrowserslist@4.24.4(transitive)
+ Addedcaniuse-lite@1.0.30001697(transitive)
+ Addedcssesc@3.0.0(transitive)
+ Addedelectron-to-chromium@1.5.93(transitive)
+ Addedescalade@3.2.0(transitive)
+ Addedfraction.js@4.3.7(transitive)
+ Addedgeneric-names@4.0.0(transitive)
+ Addedicss-replace-symbols@1.1.0(transitive)
+ Addedicss-utils@5.1.0(transitive)
+ Addedloader-utils@3.3.1(transitive)
+ Addedlodash.camelcase@4.3.0(transitive)
+ Addednanoid@3.3.8(transitive)
+ Addednode-releases@2.0.19(transitive)
+ Addednormalize-range@0.1.2(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedpostcss@8.5.1(transitive)
+ Addedpostcss-modules@4.3.1(transitive)
+ Addedpostcss-modules-extract-imports@3.1.0(transitive)
+ Addedpostcss-modules-local-by-default@4.2.0(transitive)
+ Addedpostcss-modules-scope@3.2.1(transitive)
+ Addedpostcss-modules-values@4.0.0(transitive)
+ Addedpostcss-selector-parser@7.0.0(transitive)
+ Addedpostcss-value-parser@4.2.0(transitive)
+ Addedstring-hash@1.1.3(transitive)
+ Addedupdate-browserslist-db@1.1.2(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
- Removedcss-tree@^1.1.2
- Removedfs-extra@^9.0.1
- Removedat-least-node@1.0.0(transitive)
- Removedcss-tree@1.1.3(transitive)
- Removedfs-extra@9.1.0(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedjsonfile@6.1.0(transitive)
- Removedmdn-data@2.0.14(transitive)
- Removedsource-map@0.6.1(transitive)
- Removeduniversalify@2.0.1(transitive)