@auioc/rollup-plugin-sass 0.0.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +45 -4
- package/dist/index.cjs +91 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.mjs +68 -0
- package/package.json +40 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AUIOC.ORG
|
|
4
|
+
Copyright (c) 2022-2026 PCC-Studio
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,10 +1,51 @@
|
|
|
1
1
|
# @auioc/rollup-plugin-sass
|
|
2
2
|
|
|
3
|
+
[](https://github.com/auioc/rollup-plugins/blob/main/packages/sass/LICENSE)
|
|
4
|
+
[](https://www.npmjs.com/package/@auioc/rollup-plugin-sass)
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
A Rollup plugin that compiles Sass (`.scss` / `.sass`) entry files and emits the result as a CSS asset.
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
CSS can be provided directly as a string or read from a file, and optionally minified.
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
## Install
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
```sh
|
|
13
|
+
npm install --save-dev @auioc/rollup-plugin-sass
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
// rollup.config.js
|
|
20
|
+
import sass from '@auioc/rollup-plugin-sass';
|
|
21
|
+
|
|
22
|
+
export default {
|
|
23
|
+
input: 'src/index.js',
|
|
24
|
+
output: { dir: 'dist', format: 'es' },
|
|
25
|
+
plugins: [
|
|
26
|
+
sass({
|
|
27
|
+
input: 'src/styles/main.scss',
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Options
|
|
34
|
+
|
|
35
|
+
| Option | Type | Default | Description |
|
|
36
|
+
| ------------- | ----------------------------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
37
|
+
| `input` | `string` | | **Required**. Path to the Sass entry file (`.scss` or `.sass`)<br/>Relative to `process.cwd()` or absolute. |
|
|
38
|
+
| `output` | `string` | Derived from `input` | Output file name for the emitted CSS asset. Should be a path relative to Rollup's output directory.<br/>When omitted, the name is derived from `input` by replacing the `.scss` / `.sass` extension with `.css`. |
|
|
39
|
+
| `sourceMap` | `boolean` \| `'inline'` | `false` | Controls source map generation for the compiled CSS. |
|
|
40
|
+
| `sassOptions` | `Omit<SassOptions<'async'>, 'sourceMap'>` | `{}` | Additional options forwarded directly to Sass.<br/>See the [Sass documentation](https://sass-lang.com/documentation/js-api/) for the full list of supported options. |
|
|
41
|
+
|
|
42
|
+
- `sourceMap`
|
|
43
|
+
|
|
44
|
+
- `false`: No source map is generated.
|
|
45
|
+
- `true`: An external `.map` file is emitted alongside the CSS.
|
|
46
|
+
- `'inline'`:The source map is embedded into the CSS as a data URI.
|
|
47
|
+
|
|
48
|
+
## License
|
|
49
|
+
|
|
50
|
+
Package `@auioc/rollup-plugin-sass` is licensed under the **MIT License**.
|
|
51
|
+
The full license is in the [LICENSE](./LICENSE) file.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Package bundle (CJS) of @auioc/rollup-plugin-sass
|
|
3
|
+
* https://github.com/auioc/rollup-plugins/tree/main/packages/sass
|
|
4
|
+
* Generated at 2026-11-09T02:16:30.407Z
|
|
5
|
+
* Version: v1.0.0 - tag:sass@v1.0.0@ebeb7c24
|
|
6
|
+
* Copyright (C) 2026 AUIOC.ORG
|
|
7
|
+
* Copyright (C) 2022-2026 PCC-Studio
|
|
8
|
+
* Licensed under MIT
|
|
9
|
+
*/
|
|
10
|
+
'use strict';
|
|
11
|
+
|
|
12
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
13
|
+
|
|
14
|
+
var Path = require('node:path');
|
|
15
|
+
var node_url = require('node:url');
|
|
16
|
+
var sass = require('sass');
|
|
17
|
+
|
|
18
|
+
function _interopNamespaceDefault(e) {
|
|
19
|
+
var n = Object.create(null);
|
|
20
|
+
if (e) {
|
|
21
|
+
Object.keys(e).forEach(function (k) {
|
|
22
|
+
if (k !== 'default') {
|
|
23
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
24
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return e[k]; }
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
n.default = e;
|
|
32
|
+
return Object.freeze(n);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var sass__namespace = /*#__PURE__*/_interopNamespaceDefault(sass);
|
|
36
|
+
|
|
37
|
+
const NAME = 'sass';
|
|
38
|
+
function sassPlugin(options) {
|
|
39
|
+
const { input, output, sourceMap = false, sassOptions = {} } = options;
|
|
40
|
+
return {
|
|
41
|
+
name: NAME,
|
|
42
|
+
buildStart() {
|
|
43
|
+
if (!input) {
|
|
44
|
+
this.error('options.input is required.');
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
async generateBundle() {
|
|
48
|
+
const inputPath = Path.resolve(process.cwd(), input);
|
|
49
|
+
const result = await sass__namespace.compileAsync(inputPath, {
|
|
50
|
+
sourceMap: !!sourceMap,
|
|
51
|
+
sourceMapIncludeSources: !!sourceMap,
|
|
52
|
+
...sassOptions,
|
|
53
|
+
});
|
|
54
|
+
for (const url of result.loadedUrls) {
|
|
55
|
+
if (url.protocol === 'file:') {
|
|
56
|
+
this.addWatchFile(node_url.fileURLToPath(url));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const cssFileName = output ||
|
|
60
|
+
Path.basename(inputPath).replace(/\.(scss|sass)$/i, '.css');
|
|
61
|
+
this.info(`compiled ${input} -> ${cssFileName}`);
|
|
62
|
+
let css = result.css;
|
|
63
|
+
const inlineMap = sourceMap === 'inline';
|
|
64
|
+
const externalMap = sourceMap && !inlineMap;
|
|
65
|
+
if (externalMap) {
|
|
66
|
+
const mapFileName = `${cssFileName}.map`;
|
|
67
|
+
css = `${css}\n/*# sourceMappingURL=${Path.basename(mapFileName)} */`;
|
|
68
|
+
this.emitFile({
|
|
69
|
+
type: 'asset',
|
|
70
|
+
fileName: mapFileName,
|
|
71
|
+
name: mapFileName,
|
|
72
|
+
source: JSON.stringify(result.sourceMap),
|
|
73
|
+
needsCodeReference: false,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (inlineMap) {
|
|
77
|
+
const b64 = Buffer.from(JSON.stringify(result.sourceMap)).toString('base64');
|
|
78
|
+
css = `${css}\n/*# sourceMappingURL=data:application/json;base64,${b64} */`;
|
|
79
|
+
}
|
|
80
|
+
this.emitFile({
|
|
81
|
+
type: 'asset',
|
|
82
|
+
fileName: cssFileName,
|
|
83
|
+
name: cssFileName,
|
|
84
|
+
source: css,
|
|
85
|
+
needsCodeReference: false,
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
exports.default = sassPlugin;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Type definitions of @auioc/rollup-plugin-sass
|
|
3
|
+
* https://github.com/auioc/rollup-plugins/tree/main/packages/sass
|
|
4
|
+
* Generated at 2026-11-09T02:16:30.407Z
|
|
5
|
+
* Version: v1.0.0 - tag:sass@v1.0.0@ebeb7c24
|
|
6
|
+
* Copyright (C) 2026 AUIOC.ORG
|
|
7
|
+
* Copyright (C) 2022-2026 PCC-Studio
|
|
8
|
+
* Licensed under MIT
|
|
9
|
+
*/
|
|
10
|
+
import { Plugin } from 'rollup';
|
|
11
|
+
import { Options as Options$1 } from 'sass';
|
|
12
|
+
|
|
13
|
+
interface Options {
|
|
14
|
+
/**
|
|
15
|
+
* Path to the Sass entry file (`.scss` or `.sass`), relative to `process.cwd()` or absolute.
|
|
16
|
+
*
|
|
17
|
+
* @required
|
|
18
|
+
* @example 'src/styles/main.scss'
|
|
19
|
+
*/
|
|
20
|
+
input: string;
|
|
21
|
+
/**
|
|
22
|
+
* Output file name for the emitted CSS asset.
|
|
23
|
+
*
|
|
24
|
+
* Should be a path relative to Rollup's output directory.
|
|
25
|
+
*
|
|
26
|
+
* When omitted, the name is derived from `input` by replacing the
|
|
27
|
+
* `.scss` / `.sass` extension with `.css` (e.g. `main.scss` → `main.css`).
|
|
28
|
+
*
|
|
29
|
+
* @default Derived from `input` (basename with `.css` extension)
|
|
30
|
+
* @example 'assets/main.css'
|
|
31
|
+
*/
|
|
32
|
+
output?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Controls source map generation for the compiled CSS.
|
|
35
|
+
*
|
|
36
|
+
* - `false` — no source map is generated.
|
|
37
|
+
* - `true` — an external `.map` file is emitted alongside the CSS.
|
|
38
|
+
* - `'inline'` — the source map is embedded into the CSS.
|
|
39
|
+
*
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
sourceMap?: boolean | 'inline';
|
|
43
|
+
/**
|
|
44
|
+
* Additional options forwarded directly to Sass.
|
|
45
|
+
*
|
|
46
|
+
* @default {}
|
|
47
|
+
* @example { style: 'compressed', loadPaths: ['src/styles'] }
|
|
48
|
+
*/
|
|
49
|
+
sassOptions?: Omit<Options$1<'async'>, 'sourceMap'>;
|
|
50
|
+
}
|
|
51
|
+
declare function sassPlugin(options: Options): Plugin;
|
|
52
|
+
|
|
53
|
+
export { sassPlugin as default };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Package bundle (ESM) of @auioc/rollup-plugin-sass
|
|
3
|
+
* https://github.com/auioc/rollup-plugins/tree/main/packages/sass
|
|
4
|
+
* Generated at 2026-11-09T02:16:30.407Z
|
|
5
|
+
* Version: v1.0.0 - tag:sass@v1.0.0@ebeb7c24
|
|
6
|
+
* Copyright (C) 2026 AUIOC.ORG
|
|
7
|
+
* Copyright (C) 2022-2026 PCC-Studio
|
|
8
|
+
* Licensed under MIT
|
|
9
|
+
*/
|
|
10
|
+
import Path from 'node:path';
|
|
11
|
+
import { fileURLToPath } from 'node:url';
|
|
12
|
+
import * as sass from 'sass';
|
|
13
|
+
|
|
14
|
+
const NAME = 'sass';
|
|
15
|
+
function sassPlugin(options) {
|
|
16
|
+
const { input, output, sourceMap = false, sassOptions = {} } = options;
|
|
17
|
+
return {
|
|
18
|
+
name: NAME,
|
|
19
|
+
buildStart() {
|
|
20
|
+
if (!input) {
|
|
21
|
+
this.error('options.input is required.');
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
async generateBundle() {
|
|
25
|
+
const inputPath = Path.resolve(process.cwd(), input);
|
|
26
|
+
const result = await sass.compileAsync(inputPath, {
|
|
27
|
+
sourceMap: !!sourceMap,
|
|
28
|
+
sourceMapIncludeSources: !!sourceMap,
|
|
29
|
+
...sassOptions,
|
|
30
|
+
});
|
|
31
|
+
for (const url of result.loadedUrls) {
|
|
32
|
+
if (url.protocol === 'file:') {
|
|
33
|
+
this.addWatchFile(fileURLToPath(url));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const cssFileName = output ||
|
|
37
|
+
Path.basename(inputPath).replace(/\.(scss|sass)$/i, '.css');
|
|
38
|
+
this.info(`compiled ${input} -> ${cssFileName}`);
|
|
39
|
+
let css = result.css;
|
|
40
|
+
const inlineMap = sourceMap === 'inline';
|
|
41
|
+
const externalMap = sourceMap && !inlineMap;
|
|
42
|
+
if (externalMap) {
|
|
43
|
+
const mapFileName = `${cssFileName}.map`;
|
|
44
|
+
css = `${css}\n/*# sourceMappingURL=${Path.basename(mapFileName)} */`;
|
|
45
|
+
this.emitFile({
|
|
46
|
+
type: 'asset',
|
|
47
|
+
fileName: mapFileName,
|
|
48
|
+
name: mapFileName,
|
|
49
|
+
source: JSON.stringify(result.sourceMap),
|
|
50
|
+
needsCodeReference: false,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (inlineMap) {
|
|
54
|
+
const b64 = Buffer.from(JSON.stringify(result.sourceMap)).toString('base64');
|
|
55
|
+
css = `${css}\n/*# sourceMappingURL=data:application/json;base64,${b64} */`;
|
|
56
|
+
}
|
|
57
|
+
this.emitFile({
|
|
58
|
+
type: 'asset',
|
|
59
|
+
fileName: cssFileName,
|
|
60
|
+
name: cssFileName,
|
|
61
|
+
source: css,
|
|
62
|
+
needsCodeReference: false,
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { sassPlugin as default };
|
package/package.json
CHANGED
|
@@ -1,10 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@auioc/rollup-plugin-sass",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Rollup plugin - compile standalone sass/scss files",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
"rollup",
|
|
7
|
+
"plugin",
|
|
8
|
+
"rollup-plugin",
|
|
9
|
+
"sass"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"homepage": "https://github.com/auioc/rollup-plugins/tree/main/packages/sass",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/auioc/rollup-plugins.git",
|
|
16
|
+
"directory": "packages/sass"
|
|
17
|
+
},
|
|
18
|
+
"author": {
|
|
19
|
+
"name": "AUIOC",
|
|
20
|
+
"url": "https://auioc.org"
|
|
21
|
+
},
|
|
22
|
+
"type": "module",
|
|
23
|
+
"main": "./dist/index.cjs",
|
|
24
|
+
"module": "./dist/index.mjs",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"import": "./dist/index.mjs",
|
|
29
|
+
"default": "./dist/index.cjs"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist"
|
|
33
|
+
],
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"sass": "^1.108.1"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "rollup -c"
|
|
42
|
+
}
|
|
43
|
+
}
|