This commit is contained in:
2023-08-11 10:45:20 +08:00
commit 161ca982f3
31850 changed files with 2706500 additions and 0 deletions

20
node_modules/sass-loader/LICENSE generated vendored Normal file
View File

@ -0,0 +1,20 @@
Copyright JS Foundation and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

962
node_modules/sass-loader/README.md generated vendored Normal file
View File

@ -0,0 +1,962 @@
<div align="center">
<img height="170"
src="https://worldvectorlogo.com/logos/sass-1.svg">
<a href="https://github.com/webpack/webpack">
<img width="200" height="200"
src="https://webpack.js.org/assets/icon-square-big.svg">
</a>
</div>
[![npm][npm]][npm-url]
[![node][node]][node-url]
[![tests][tests]][tests-url]
[![coverage][cover]][cover-url]
[![discussion][discussion]][discussion-url]
[![size][size]][size-url]
# sass-loader
Loads a Sass/SCSS file and compiles it to CSS.
## Getting Started
To begin, you'll need to install `sass-loader`:
```console
npm install sass-loader sass webpack --save-dev
```
or
```console
yarn add -D sass-loader sass webpack
```
or
```console
pnpm add -D sass-loader sass webpack
```
`sass-loader` requires you to install either [Dart Sass](https://github.com/sass/dart-sass), [Node Sass](https://github.com/sass/node-sass) on your own (more documentation can be found below) or [Sass Embedded](https://github.com/sass/embedded-host-node).
This allows you to control the versions of all your dependencies, and to choose which Sass implementation to use.
> **Note**
>
> We highly recommend using [Dart Sass](https://github.com/sass/dart-sass).
> **Warning**
>
> [Node Sass](https://github.com/sass/node-sass) does not work with [Yarn PnP](https://classic.yarnpkg.com/en/docs/pnp/) feature and doesn't support [@use rule](https://sass-lang.com/documentation/at-rules/use).
> **Warning**
>
> [Sass Embedded](https://github.com/sass/embedded-host-node) is experimental and in `beta`, therefore some features may not work
Chain the `sass-loader` with the [css-loader](https://github.com/webpack-contrib/css-loader) and the [style-loader](https://github.com/webpack-contrib/style-loader) to immediately apply all styles to the DOM or the [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) to extract it into a separate file.
Then add the loader to your Webpack configuration. For example:
**app.js**
```js
import "./style.scss";
```
**style.scss**
```scss
$body-color: red;
body {
color: $body-color;
}
```
**webpack.config.js**
```js
module.exports = {
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
// Creates `style` nodes from JS strings
"style-loader",
// Translates CSS into CommonJS
"css-loader",
// Compiles Sass to CSS
"sass-loader",
],
},
],
},
};
```
Finally run `webpack` via your preferred method.
### The `outputStyle` (old API) and `style` (new API) options in `production` mode
For `production` mode, the `outputStyle` (old API) and `style` (new API) options default to `compressed` unless otherwise specified in `sassOptions`.
### Resolving `import` at-rules
Webpack provides an [advanced mechanism to resolve files](https://webpack.js.org/concepts/module-resolution/).
The `sass-loader` uses Sass's custom importer feature to pass all queries to the Webpack resolving engine.
Thus you can import your Sass modules from `node_modules`.
```scss
@import "bootstrap";
```
Using `~` is deprecated and can be removed from your code (**we recommend it**), but we still support it for historical reasons.
Why can you remove it? The loader will first try to resolve `@import` as a relative path. If it cannot be resolved, then the loader will try to resolve `@import` inside [`node_modules`](https://webpack.js.org/configuration/resolve/#resolvemodules).
Prepending module paths with a `~` tells webpack to search through [`node_modules`](https://webpack.js.org/configuration/resolve/#resolvemodules).
```scss
@import "~bootstrap";
```
It's important to prepend it with only `~`, because `~/` resolves to the home directory.
Webpack needs to distinguish between `bootstrap` and `~bootstrap` because CSS and Sass files have no special syntax for importing relative files.
Writing `@import "style.scss"` is the same as `@import "./style.scss";`
### Problems with `url(...)`
Since Sass implementations don't provide [url rewriting](https://github.com/sass/libsass/issues/532), all linked assets must be relative to the output.
- If you pass the generated CSS on to the `css-loader`, all urls must be relative to the entry-file (e.g. `main.scss`).
- If you're just generating CSS without passing it to the `css-loader`, it must be relative to your web root.
You will be disrupted by this first issue. It is natural to expect relative references to be resolved against the `.sass`/`.scss` file in which they are specified (like in regular `.css` files).
Thankfully there are a two solutions to this problem:
- Add the missing url rewriting using the [resolve-url-loader](https://github.com/bholloway/resolve-url-loader). Place it before `sass-loader` in the loader chain.
- Library authors usually provide a variable to modify the asset path. [bootstrap-sass](https://github.com/twbs/bootstrap-sass) for example has an `$icon-font-path`.
## Options
- **[`implementation`](#implementation)**
- **[`sassOptions`](#sassoptions)**
- **[`sourceMap`](#sourcemap)**
- **[`additionalData`](#additionaldata)**
- **[`webpackImporter`](#webpackimporter)**
- **[`warnRuleAsWarning`](#warnruleaswarning)**
### `implementation`
Type:
```ts
type implementation = object | string;
```
Default: `sass`
The special `implementation` option determines which implementation of Sass to use.
By default the loader resolve the implementation based on your dependencies.
Just add required implementation to `package.json` (`sass` or `node-sass` package) and install dependencies.
Example where the `sass-loader` loader uses the `sass` (`dart-sass`) implementation:
**package.json**
```json
{
"devDependencies": {
"sass-loader": "^7.2.0",
"sass": "^1.22.10"
}
}
```
Example where the `sass-loader` loader uses the `node-sass` implementation:
**package.json**
```json
{
"devDependencies": {
"sass-loader": "^7.2.0",
"node-sass": "^5.0.0"
}
}
```
Beware the situation when `node-sass` and `sass` were installed! By default the `sass-loader` prefers `sass`.
In order to avoid this situation you can use the `implementation` option.
The `implementation` options either accepts `sass` (`Dart Sass`) or `node-sass` as a module.
#### `object`
For example, to use Dart Sass, you'd pass:
```js
module.exports = {
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
"style-loader",
"css-loader",
{
loader: "sass-loader",
options: {
// Prefer `dart-sass`
implementation: require("sass"),
},
},
],
},
],
},
};
```
#### `string`
For example, to use Dart Sass, you'd pass:
```js
module.exports = {
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
"style-loader",
"css-loader",
{
loader: "sass-loader",
options: {
// Prefer `dart-sass`
implementation: require.resolve("sass"),
},
},
],
},
],
},
};
```
Note that when using `sass` (`Dart Sass`), **synchronous compilation is twice as fast as asynchronous compilation** by default, due to the overhead of asynchronous callbacks.
To avoid this overhead, you can use the [fibers](https://www.npmjs.com/package/fibers) package to call asynchronous importers from the synchronous code path.
We automatically inject the [`fibers`](https://github.com/laverdet/node-fibers) package (setup `sassOptions.fiber`) for `Node.js` less v16.0.0 if is possible (i.e. you need install the [`fibers`](https://github.com/laverdet/node-fibers) package).
> **Warning**
>
> Fibers is not compatible with `Node.js` v16.0.0 or later. Unfortunately, v8 commit [dacc2fee0f](https://github.com/v8/v8/commit/dacc2fee0f815823782a7e432c79c2a7767a4765) is a breaking change and workarounds are non-trivial. ([see introduction to readme](https://github.com/laverdet/node-fibers)).
**package.json**
```json
{
"devDependencies": {
"sass-loader": "^7.2.0",
"sass": "^1.22.10",
"fibers": "^4.0.1"
}
}
```
You can disable automatically injecting the [`fibers`](https://github.com/laverdet/node-fibers) package by passing a `false` value for the `sassOptions.fiber` option.
**webpack.config.js**
```js
module.exports = {
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
"style-loader",
"css-loader",
{
loader: "sass-loader",
options: {
implementation: require("sass"),
sassOptions: {
fiber: false,
},
},
},
],
},
],
},
};
```
You can also pass the `fiber` value using this code:
**webpack.config.js**
```js
module.exports = {
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
"style-loader",
"css-loader",
{
loader: "sass-loader",
options: {
implementation: require("sass"),
sassOptions: {
fiber: require("fibers"),
},
},
},
],
},
],
},
};
```
### `sassOptions`
Type:
```ts
type sassOptions =
| import("sass").LegacyOptions<"async">
| ((
content: string | Buffer,
loaderContext: LoaderContext,
meta: any
) => import("sass").LegacyOptions<"async">);
```
Default: defaults values for Sass implementation
Options for [Dart Sass](http://sass-lang.com/dart-sass) or [Node Sass](https://github.com/sass/node-sass) implementation.
> **Note**
>
> The `charset` option has `true` value by default for `dart-sass`, we strongly discourage change value to `false`, because webpack doesn't support files other than `utf-8`.
> **Note**
>
> The `indentedSyntax` option has `true` value for the `sass` extension.
> **Note**
>
> Options such as `data` and `file` are unavailable and will be ignored.
> We strongly discourage change `outFile`, `sourceMapContents`, `sourceMapEmbed`, `sourceMapRoot` options because `sass-loader` automatically sets these options when the `sourceMap` option is `true`.
> **Note**
>
> Access to the [loader context](https://webpack.js.org/api/loaders/#the-loader-context) inside the custom importer can be done using the `this.webpackLoaderContext` property.
There is a slight difference between the `sass` (`dart-sass`) and `node-sass` options.
Please consult documentation before using them:
- [Dart Sass documentation](https://sass-lang.com/documentation/js-api/interfaces/Options) for all available `sass` options.
- [Node Sass documentation](https://github.com/sass/node-sass/#options) for all available `node-sass` options.
#### `object`
Use an object for the Sass implementation setup.
**webpack.config.js**
```js
module.exports = {
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
"style-loader",
"css-loader",
{
loader: "sass-loader",
options: {
sassOptions: {
indentWidth: 4,
includePaths: ["absolute/path/a", "absolute/path/b"],
},
},
},
],
},
],
},
};
```
#### `function`
Allows to setup the Sass implementation by setting different options based on the loader context.
```js
module.exports = {
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
"style-loader",
"css-loader",
{
loader: "sass-loader",
options: {
sassOptions: (loaderContext) => {
// More information about available properties https://webpack.js.org/api/loaders/
const { resourcePath, rootContext } = loaderContext;
const relativePath = path.relative(rootContext, resourcePath);
if (relativePath === "styles/foo.scss") {
return {
includePaths: ["absolute/path/c", "absolute/path/d"],
};
}
return {
includePaths: ["absolute/path/a", "absolute/path/b"],
};
},
},
},
],
},
],
},
};
```
### `sourceMap`
Type:
```ts
type sourceMap = boolean;
```
Default: depends on the `compiler.devtool` value
Enables/Disables generation of source maps.
By default generation of source maps depends on the [`devtool`](https://webpack.js.org/configuration/devtool/) option.
All values enable source map generation except `eval` and `false` value.
> If a `true` the `sourceMap`, `sourceMapRoot`, `sourceMapEmbed`, `sourceMapContents` and `omitSourceMapUrl` from `sassOptions` will be ignored.
**webpack.config.js**
```js
module.exports = {
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
"style-loader",
{
loader: "css-loader",
options: {
sourceMap: true,
},
},
{
loader: "sass-loader",
options: {
sourceMap: true,
},
},
],
},
],
},
};
```
> In some rare cases `node-sass` can output invalid source maps (it is a `node-sass` bug).
> > In order to avoid this, you can try to update `node-sass` to latest version or you can try to set within `sassOptions` the `outputStyle` option to `compressed`.
**webpack.config.js**
```js
module.exports = {
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
"style-loader",
"css-loader",
{
loader: "sass-loader",
options: {
sourceMap: true,
sassOptions: {
outputStyle: "compressed",
},
},
},
],
},
],
},
};
```
### `additionalData`
Type:
```ts
type additionalData =
| string
| ((content: string | Buffer, loaderContext: LoaderContext) => string);
```
Default: `undefined`
Prepends `Sass`/`SCSS` code before the actual entry file.
In this case, the `sass-loader` will not override the `data` option but just **prepend** the entry's content.
This is especially useful when some of your Sass variables depend on the environment:
#### `string`
```js
module.exports = {
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
"style-loader",
"css-loader",
{
loader: "sass-loader",
options: {
additionalData: "$env: " + process.env.NODE_ENV + ";",
},
},
],
},
],
},
};
```
#### `function`
##### Sync
```js
module.exports = {
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
"style-loader",
"css-loader",
{
loader: "sass-loader",
options: {
additionalData: (content, loaderContext) => {
// More information about available properties https://webpack.js.org/api/loaders/
const { resourcePath, rootContext } = loaderContext;
const relativePath = path.relative(rootContext, resourcePath);
if (relativePath === "styles/foo.scss") {
return "$value: 100px;" + content;
}
return "$value: 200px;" + content;
},
},
},
],
},
],
},
};
```
##### Async
```js
module.exports = {
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
"style-loader",
"css-loader",
{
loader: "sass-loader",
options: {
additionalData: async (content, loaderContext) => {
// More information about available properties https://webpack.js.org/api/loaders/
const { resourcePath, rootContext } = loaderContext;
const relativePath = path.relative(rootContext, resourcePath);
if (relativePath === "styles/foo.scss") {
return "$value: 100px;" + content;
}
return "$value: 200px;" + content;
},
},
},
],
},
],
},
};
```
### `webpackImporter`
Type:
```ts
type webpackImporter = boolean;
```
Default: `true`
Enables/Disables the default Webpack importer.
This can improve performance in some cases. Use it with caution because aliases and `@import` at-rules starting with `~` will not work.
You can pass own `importer` to solve this (see [`importer docs`](https://github.com/sass/node-sass#importer--v200---experimental)).
**webpack.config.js**
```js
module.exports = {
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
"style-loader",
"css-loader",
{
loader: "sass-loader",
options: {
webpackImporter: false,
},
},
],
},
],
},
};
```
### `warnRuleAsWarning`
Type:
```ts
type warnRuleAsWarning = boolean;
```
Default: `false`
Treats the `@warn` rule as a webpack warning.
> **Note**
>
> It will be `true` by default in the next major release.
**style.scss**
```scss
$known-prefixes: webkit, moz, ms, o;
@mixin prefix($property, $value, $prefixes) {
@each $prefix in $prefixes {
@if not index($known-prefixes, $prefix) {
@warn "Unknown prefix #{$prefix}.";
}
-#{$prefix}-#{$property}: $value;
}
#{$property}: $value;
}
.tilt {
// Oops, we typo'd "webkit" as "wekbit"!
@include prefix(transform, rotate(15deg), wekbit ms);
}
```
The presented code will throw webpack warning instead logging.
To ignore unnecessary warnings you can use the [ignoreWarnings](https://webpack.js.org/configuration/other-options/#ignorewarnings) option.
**webpack.config.js**
```js
module.exports = {
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
"style-loader",
"css-loader",
{
loader: "sass-loader",
options: {
warnRuleAsWarning: true,
},
},
],
},
],
},
};
```
### `api`
Type:
```ts
type api = "legacy" | "modern";
```
Default: `"legacy"`
Allows you to switch between `legacy` and `modern` API. You can find more information [here](https://sass-lang.com/documentation/js-api).
> **Warning**
>
> "modern" API is experimental, so some features may not work (known: built-in `importer` is not working and files with errors is not watching on initial run), you can follow this [here](https://github.com/webpack-contrib/sass-loader/issues/774).
> **Warning**
>
> The sass options are different for `modern` and `old` APIs. Please look at [docs](https://sass-lang.com/documentation/js-api) how to migrate on new options.
**webpack.config.js**
```js
module.exports = {
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
"style-loader",
"css-loader",
{
loader: "sass-loader",
options: {
api: "modern",
sassOptions: {
// Your sass options
},
},
},
],
},
],
},
};
```
## How to enable `@debug` output
Defaults, the output of `@debug` messages is disabled.
To enable it, add to **webpack.config.js** following:
```js
module.exports = {
stats: {
loggingDebug: ["sass-loader"],
},
// ...
};
```
## Examples
### Extracts CSS into separate files
For production builds it's recommended to extract the CSS from your bundle being able to use parallel loading of CSS/JS resources later on.
There are four possibilities to extract a style sheet from the bundle:
#### 1. [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin)
**webpack.config.js**
```js
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
// fallback to style-loader in development
process.env.NODE_ENV !== "production"
? "style-loader"
: MiniCssExtractPlugin.loader,
"css-loader",
"sass-loader",
],
},
],
},
plugins: [
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: "[name].css",
chunkFilename: "[id].css",
}),
],
};
```
#### 2. [Asset Modules](https://webpack.js.org/guides/asset-modules/)
**webpack.config.js**
```js
module.exports = {
entry: [__dirname + "/src/scss/app.scss"],
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: [],
},
{
test: /\.scss$/,
exclude: /node_modules/,
type: "asset/resource",
generator: {
filename: "bundle.css",
},
use: ["sass-loader"],
},
],
},
};
```
#### 3. [extract-loader](https://github.com/peerigon/extract-loader) (simpler, but specialized on the css-loader's output)
#### 4. [file-loader](https://github.com/webpack-contrib/file-loader) (deprecated--should only be used in Webpack v4)
**webpack.config.js**
```js
module.exports = {
entry: [__dirname + "/src/scss/app.scss"],
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: [],
},
{
test: /\.scss$/,
exclude: /node_modules/,
use: [
{
loader: "file-loader",
options: { outputPath: "css/", name: "[name].min.css" },
},
"sass-loader",
],
},
],
},
};
```
(source: https://stackoverflow.com/a/60029923/2969615)
### Source maps
Enables/Disables generation of source maps.
To enable CSS source maps, you'll need to pass the `sourceMap` option to the `sass-loader` _and_ the css-loader.
**webpack.config.js**
```javascript
module.exports = {
devtool: "source-map", // any "source-map"-like devtool is possible
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
"style-loader",
{
loader: "css-loader",
options: {
sourceMap: true,
},
},
{
loader: "sass-loader",
options: {
sourceMap: true,
},
},
],
},
],
},
};
```
If you want to edit the original Sass files inside Chrome, [there's a good blog post](https://medium.com/@toolmantim/getting-started-with-css-sourcemaps-and-in-browser-sass-editing-b4daab987fb0). Checkout [test/sourceMap](https://github.com/webpack-contrib/sass-loader/tree/master/test) for a running example.
## Contributing
Please take a moment to read our contributing guidelines if you haven't yet done so.
[CONTRIBUTING](./.github/CONTRIBUTING.md)
## License
[MIT](./LICENSE)
[npm]: https://img.shields.io/npm/v/sass-loader.svg
[npm-url]: https://npmjs.com/package/sass-loader
[node]: https://img.shields.io/node/v/sass-loader.svg
[node-url]: https://nodejs.org
[tests]: https://github.com/webpack-contrib/sass-loader/workflows/sass-loader/badge.svg
[tests-url]: https://github.com/webpack-contrib/sass-loader/actions
[cover]: https://codecov.io/gh/webpack-contrib/sass-loader/branch/master/graph/badge.svg
[cover-url]: https://codecov.io/gh/webpack-contrib/sass-loader
[discussion]: https://img.shields.io/github/discussions/webpack/webpack
[discussion-url]: https://github.com/webpack/webpack/discussions
[size]: https://packagephobia.now.sh/badge?p=sass-loader
[size-url]: https://packagephobia.now.sh/result?p=sass-loader

4
node_modules/sass-loader/dist/cjs.js generated vendored Normal file
View File

@ -0,0 +1,4 @@
"use strict";
const loader = require("./index");
module.exports = loader.default;

100
node_modules/sass-loader/dist/index.js generated vendored Normal file
View File

@ -0,0 +1,100 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _url = _interopRequireDefault(require("url"));
var _path = _interopRequireDefault(require("path"));
var _options = _interopRequireDefault(require("./options.json"));
var _utils = require("./utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* The sass-loader makes node-sass and dart-sass available to webpack modules.
*
* @this {object}
* @param {string} content
*/
async function loader(content) {
const options = this.getOptions(_options.default);
const callback = this.async();
let implementation;
try {
implementation = (0, _utils.getSassImplementation)(this, options.implementation);
} catch (error) {
callback(error);
return;
}
const useSourceMap = typeof options.sourceMap === "boolean" ? options.sourceMap : this.sourceMap;
const sassOptions = await (0, _utils.getSassOptions)(this, options, content, implementation, useSourceMap);
const shouldUseWebpackImporter = typeof options.webpackImporter === "boolean" ? options.webpackImporter : true;
if (shouldUseWebpackImporter) {
const isModernAPI = options.api === "modern";
if (!isModernAPI) {
const {
includePaths
} = sassOptions;
sassOptions.importer.push((0, _utils.getWebpackImporter)(this, implementation, includePaths));
} else {
sassOptions.importers.push((0, _utils.getModernWebpackImporter)(this, implementation));
}
}
let compile;
try {
compile = (0, _utils.getCompileFn)(implementation, options);
} catch (error) {
callback(error);
return;
}
let result;
try {
result = await compile(sassOptions, options);
} catch (error) {
// There are situations when the `file`/`span.url` property do not exist
// Modern API
if (error.span && typeof error.span.url !== "undefined") {
this.addDependency(_url.default.fileURLToPath(error.span.url));
}
// Legacy API
else if (typeof error.file !== "undefined") {
// `node-sass` returns POSIX paths
this.addDependency(_path.default.normalize(error.file));
}
callback((0, _utils.errorFactory)(error));
return;
}
let map =
// Modern API, then legacy API
result.sourceMap ? result.sourceMap : result.map ? JSON.parse(result.map) : null;
// Modify source paths only for webpack, otherwise we do nothing
if (map && useSourceMap) {
map = (0, _utils.normalizeSourceMap)(map, this.rootContext);
}
// Modern API
if (typeof result.loadedUrls !== "undefined") {
result.loadedUrls.filter(url => url.protocol === "file:").forEach(includedFile => {
const normalizedIncludedFile = _url.default.fileURLToPath(includedFile);
// Custom `importer` can return only `contents` so includedFile will be relative
if (_path.default.isAbsolute(normalizedIncludedFile)) {
this.addDependency(normalizedIncludedFile);
}
});
}
// Legacy API
else if (typeof result.stats !== "undefined" && typeof result.stats.includedFiles !== "undefined") {
result.stats.includedFiles.forEach(includedFile => {
const normalizedIncludedFile = _path.default.normalize(includedFile);
// Custom `importer` can return only `contents` so includedFile will be relative
if (_path.default.isAbsolute(normalizedIncludedFile)) {
this.addDependency(normalizedIncludedFile);
}
});
}
callback(null, result.css.toString(), map);
}
var _default = loader;
exports.default = _default;

64
node_modules/sass-loader/dist/options.json generated vendored Normal file
View File

@ -0,0 +1,64 @@
{
"title": "Sass Loader options",
"type": "object",
"properties": {
"implementation": {
"description": "The implementation of the sass to be used.",
"link": "https://github.com/webpack-contrib/sass-loader#implementation",
"anyOf": [
{
"type": "string"
},
{
"type": "object"
}
]
},
"api": {
"description": "Switch between old and modern API for `sass` (`Dart Sass`) and `Sass Embedded` implementations.",
"link": "https://github.com/webpack-contrib/sass-loader#sassoptions",
"enum": ["legacy", "modern"]
},
"sassOptions": {
"description": "Options for `node-sass` or `sass` (`Dart Sass`) implementation.",
"link": "https://github.com/webpack-contrib/sass-loader#sassoptions",
"anyOf": [
{
"type": "object",
"additionalProperties": true
},
{
"instanceof": "Function"
}
]
},
"additionalData": {
"description": "Prepends/Appends `Sass`/`SCSS` code before the actual entry file.",
"link": "https://github.com/webpack-contrib/sass-loader#additionaldata",
"anyOf": [
{
"type": "string"
},
{
"instanceof": "Function"
}
]
},
"sourceMap": {
"description": "Enables/Disables generation of source maps.",
"link": "https://github.com/webpack-contrib/sass-loader#sourcemap",
"type": "boolean"
},
"webpackImporter": {
"description": "Enables/Disables default `webpack` importer.",
"link": "https://github.com/webpack-contrib/sass-loader#webpackimporter",
"type": "boolean"
},
"warnRuleAsWarning": {
"description": "Treats the '@warn' rule as a webpack warning.",
"link": "https://github.com/webpack-contrib/sass-loader#warnruleaswarning",
"type": "boolean"
}
},
"additionalProperties": false
}

635
node_modules/sass-loader/dist/utils.js generated vendored Normal file
View File

@ -0,0 +1,635 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.errorFactory = errorFactory;
exports.getCompileFn = getCompileFn;
exports.getModernWebpackImporter = getModernWebpackImporter;
exports.getSassImplementation = getSassImplementation;
exports.getSassOptions = getSassOptions;
exports.getWebpackImporter = getWebpackImporter;
exports.getWebpackResolver = getWebpackResolver;
exports.isSupportedFibers = isSupportedFibers;
exports.normalizeSourceMap = normalizeSourceMap;
var _url = _interopRequireDefault(require("url"));
var _path = _interopRequireDefault(require("path"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getDefaultSassImplementation() {
let sassImplPkg = "sass";
try {
require.resolve("sass");
} catch (ignoreError) {
try {
require.resolve("node-sass");
sassImplPkg = "node-sass";
} catch (_ignoreError) {
try {
require.resolve("sass-embedded");
sassImplPkg = "sass-embedded";
} catch (__ignoreError) {
sassImplPkg = "sass";
}
}
}
// eslint-disable-next-line import/no-dynamic-require, global-require
return require(sassImplPkg);
}
/**
* This function is not Webpack-specific and can be used by tools wishing to mimic `sass-loader`'s behaviour, so its signature should not be changed.
*/
function getSassImplementation(loaderContext, implementation) {
let resolvedImplementation = implementation;
if (!resolvedImplementation) {
resolvedImplementation = getDefaultSassImplementation();
}
if (typeof resolvedImplementation === "string") {
// eslint-disable-next-line import/no-dynamic-require, global-require
resolvedImplementation = require(resolvedImplementation);
}
const {
info
} = resolvedImplementation;
if (!info) {
throw new Error("Unknown Sass implementation.");
}
const infoParts = info.split("\t");
if (infoParts.length < 2) {
throw new Error(`Unknown Sass implementation "${info}".`);
}
const [implementationName] = infoParts;
if (implementationName === "dart-sass") {
// eslint-disable-next-line consistent-return
return resolvedImplementation;
} else if (implementationName === "node-sass") {
// eslint-disable-next-line consistent-return
return resolvedImplementation;
} else if (implementationName === "sass-embedded") {
// eslint-disable-next-line consistent-return
return resolvedImplementation;
}
throw new Error(`Unknown Sass implementation "${implementationName}".`);
}
/**
* @param {any} loaderContext
* @returns {boolean}
*/
function isProductionLikeMode(loaderContext) {
return loaderContext.mode === "production" || !loaderContext.mode;
}
function proxyCustomImporters(importers, loaderContext) {
return [].concat(importers).map(importer => function proxyImporter(...args) {
const self = {
...this,
webpackLoaderContext: loaderContext
};
return importer.apply(self, args);
});
}
function isSupportedFibers() {
const [nodeVersion] = process.versions.node.split(".");
return Number(nodeVersion) < 16;
}
/**
* Derives the sass options from the loader context and normalizes its values with sane defaults.
*
* @param {object} loaderContext
* @param {object} loaderOptions
* @param {string} content
* @param {object} implementation
* @param {boolean} useSourceMap
* @returns {Object}
*/
async function getSassOptions(loaderContext, loaderOptions, content, implementation, useSourceMap) {
const options = loaderOptions.sassOptions ? typeof loaderOptions.sassOptions === "function" ? loaderOptions.sassOptions(loaderContext) || {} : loaderOptions.sassOptions : {};
const sassOptions = {
...options,
data: loaderOptions.additionalData ? typeof loaderOptions.additionalData === "function" ? await loaderOptions.additionalData(content, loaderContext) : `${loaderOptions.additionalData}\n${content}` : content
};
if (!sassOptions.logger) {
const needEmitWarning = loaderOptions.warnRuleAsWarning !== false;
const logger = loaderContext.getLogger("sass-loader");
const formatSpan = span => `${span.url || "-"}:${span.start.line}:${span.start.column}: `;
const formatDebugSpan = span => `[debug:${span.start.line}:${span.start.column}] `;
sassOptions.logger = {
debug(message, loggerOptions) {
let builtMessage = "";
if (loggerOptions.span) {
builtMessage = formatDebugSpan(loggerOptions.span);
}
builtMessage += message;
logger.debug(builtMessage);
},
warn(message, loggerOptions) {
let builtMessage = "";
if (loggerOptions.deprecation) {
builtMessage += "Deprecation ";
}
if (loggerOptions.span && !loggerOptions.stack) {
builtMessage = formatSpan(loggerOptions.span);
}
builtMessage += message;
if (loggerOptions.stack) {
builtMessage += `\n\n${loggerOptions.stack}`;
}
if (needEmitWarning) {
const warning = new Error(builtMessage);
warning.name = "SassWarning";
warning.stack = null;
loaderContext.emitWarning(warning);
} else {
logger.warn(builtMessage);
}
}
};
}
const isModernAPI = loaderOptions.api === "modern";
const {
resourcePath
} = loaderContext;
if (isModernAPI) {
sassOptions.url = _url.default.pathToFileURL(resourcePath);
// opt.outputStyle
if (!sassOptions.style && isProductionLikeMode(loaderContext)) {
sassOptions.style = "compressed";
}
if (useSourceMap) {
sassOptions.sourceMap = true;
}
// If we are compiling sass and indentedSyntax isn't set, automatically set it.
if (typeof sassOptions.syntax === "undefined") {
const ext = _path.default.extname(resourcePath);
if (ext && ext.toLowerCase() === ".scss") {
sassOptions.syntax = "scss";
} else if (ext && ext.toLowerCase() === ".sass") {
sassOptions.syntax = "indented";
} else if (ext && ext.toLowerCase() === ".css") {
sassOptions.syntax = "css";
}
}
sassOptions.importers = sassOptions.importers ? Array.isArray(sassOptions.importers) ? sassOptions.importers.slice() : [sassOptions.importers] : [];
} else {
sassOptions.file = resourcePath;
const isDartSass = implementation.info.includes("dart-sass");
if (isDartSass && isSupportedFibers()) {
const shouldTryToResolveFibers = !sassOptions.fiber && sassOptions.fiber !== false;
if (shouldTryToResolveFibers) {
let fibers;
try {
fibers = require.resolve("fibers");
} catch (_error) {
// Nothing
}
if (fibers) {
// eslint-disable-next-line global-require, import/no-dynamic-require
sassOptions.fiber = require(fibers);
}
} else if (sassOptions.fiber === false) {
// Don't pass the `fiber` option for `sass` (`Dart Sass`)
delete sassOptions.fiber;
}
} else {
// Don't pass the `fiber` option for `node-sass`
delete sassOptions.fiber;
}
// opt.outputStyle
if (!sassOptions.outputStyle && isProductionLikeMode(loaderContext)) {
sassOptions.outputStyle = "compressed";
}
if (useSourceMap) {
// Deliberately overriding the sourceMap option here.
// node-sass won't produce source maps if the data option is used and options.sourceMap is not a string.
// In case it is a string, options.sourceMap should be a path where the source map is written.
// But since we're using the data option, the source map will not actually be written, but
// all paths in sourceMap.sources will be relative to that path.
// Pretty complicated... :(
sassOptions.sourceMap = true;
sassOptions.outFile = _path.default.join(loaderContext.rootContext, "style.css.map");
sassOptions.sourceMapContents = true;
sassOptions.omitSourceMapUrl = true;
sassOptions.sourceMapEmbed = false;
}
const ext = _path.default.extname(resourcePath);
// If we are compiling sass and indentedSyntax isn't set, automatically set it.
if (ext && ext.toLowerCase() === ".sass" && typeof sassOptions.indentedSyntax === "undefined") {
sassOptions.indentedSyntax = true;
} else {
sassOptions.indentedSyntax = Boolean(sassOptions.indentedSyntax);
}
// Allow passing custom importers to `sass`/`node-sass`. Accepts `Function` or an array of `Function`s.
sassOptions.importer = sassOptions.importer ? proxyCustomImporters(Array.isArray(sassOptions.importer) ? sassOptions.importer.slice() : [sassOptions.importer], loaderContext) : [];
sassOptions.includePaths = [].concat(process.cwd()).concat(
// We use `includePaths` in context for resolver, so it should be always absolute
(sassOptions.includePaths ? sassOptions.includePaths.slice() : []).map(includePath => _path.default.isAbsolute(includePath) ? includePath : _path.default.join(process.cwd(), includePath))).concat(process.env.SASS_PATH ? process.env.SASS_PATH.split(process.platform === "win32" ? ";" : ":") : []);
if (typeof sassOptions.charset === "undefined") {
sassOptions.charset = true;
}
}
return sassOptions;
}
const MODULE_REQUEST_REGEX = /^[^?]*~/;
// Examples:
// - ~package
// - ~package/
// - ~@org
// - ~@org/
// - ~@org/package
// - ~@org/package/
const IS_MODULE_IMPORT = /^~([^/]+|[^/]+\/|@[^/]+[/][^/]+|@[^/]+\/?|@[^/]+[/][^/]+\/)$/;
/**
* When `sass`/`node-sass` tries to resolve an import, it uses a special algorithm.
* Since the `sass-loader` uses webpack to resolve the modules, we need to simulate that algorithm.
* This function returns an array of import paths to try.
* The last entry in the array is always the original url to enable straight-forward webpack.config aliases.
*
* We don't need emulate `dart-sass` "It's not clear which file to import." errors (when "file.ext" and "_file.ext" files are present simultaneously in the same directory).
* This reduces performance and `dart-sass` always do it on own side.
*
* @param {string} url
* @param {boolean} forWebpackResolver
* @param {boolean} fromImport
* @returns {Array<string>}
*/
function getPossibleRequests(
// eslint-disable-next-line no-shadow
url, forWebpackResolver = false, fromImport = false) {
let request = url;
// In case there is module request, send this to webpack resolver
if (forWebpackResolver) {
if (MODULE_REQUEST_REGEX.test(url)) {
request = request.replace(MODULE_REQUEST_REGEX, "");
}
if (IS_MODULE_IMPORT.test(url)) {
request = request[request.length - 1] === "/" ? request : `${request}/`;
return [...new Set([request, url])];
}
}
// Keep in mind: ext can also be something like '.datepicker' when the true extension is omitted and the filename contains a dot.
// @see https://github.com/webpack-contrib/sass-loader/issues/167
const extension = _path.default.extname(request).toLowerCase();
// Because @import is also defined in CSS, Sass needs a way of compiling plain CSS @imports without trying to import the files at compile time.
// To accomplish this, and to ensure SCSS is as much of a superset of CSS as possible, Sass will compile any @imports with the following characteristics to plain CSS imports:
// - imports where the URL ends with .css.
// - imports where the URL begins http:// or https://.
// - imports where the URL is written as a url().
// - imports that have media queries.
//
// The `node-sass` package sends `@import` ending on `.css` to importer, it is bug, so we skip resolve
if (extension === ".css") {
return [];
}
const dirname = _path.default.dirname(request);
const normalizedDirname = dirname === "." ? "" : `${dirname}/`;
const basename = _path.default.basename(request);
const basenameWithoutExtension = _path.default.basename(request, extension);
return [...new Set([].concat(fromImport ? [`${normalizedDirname}_${basenameWithoutExtension}.import${extension}`, `${normalizedDirname}${basenameWithoutExtension}.import${extension}`] : []).concat([`${normalizedDirname}_${basename}`, `${normalizedDirname}${basename}`]).concat(forWebpackResolver ? [url] : []))];
}
function promiseResolve(callbackResolve) {
return (context, request) => new Promise((resolve, reject) => {
callbackResolve(context, request, (error, result) => {
if (error) {
reject(error);
} else {
resolve(result);
}
});
});
}
async function startResolving(resolutionMap) {
if (resolutionMap.length === 0) {
return Promise.reject();
}
const [{
possibleRequests
}] = resolutionMap;
if (possibleRequests.length === 0) {
return Promise.reject();
}
const [{
resolve,
context
}] = resolutionMap;
try {
return await resolve(context, possibleRequests[0]);
} catch (_ignoreError) {
const [, ...tailResult] = possibleRequests;
if (tailResult.length === 0) {
const [, ...tailResolutionMap] = resolutionMap;
return startResolving(tailResolutionMap);
}
// eslint-disable-next-line no-param-reassign
resolutionMap[0].possibleRequests = tailResult;
return startResolving(resolutionMap);
}
}
const IS_SPECIAL_MODULE_IMPORT = /^~[^/]+$/;
// `[drive_letter]:\` + `\\[server]\[sharename]\`
const IS_NATIVE_WIN32_PATH = /^[a-z]:[/\\]|^\\\\/i;
/**
* @public
* Create the resolve function used in the custom Sass importer.
*
* Can be used by external tools to mimic how `sass-loader` works, for example
* in a Jest transform. Such usages will want to wrap `resolve.create` from
* [`enhanced-resolve`]{@link https://github.com/webpack/enhanced-resolve} to
* pass as the `resolverFactory` argument.
*
* @param {Function} resolverFactory - A factory function for creating a Webpack
* resolver.
* @param {Object} implementation - The imported Sass implementation, both
* `sass` (Dart Sass) and `node-sass` are supported.
* @param {string[]} [includePaths] - The list of include paths passed to Sass.
*
* @throws If a compatible Sass implementation cannot be found.
*/
function getWebpackResolver(resolverFactory, implementation, includePaths = []) {
const isDartSass = implementation && implementation.info.includes("dart-sass");
// We only have one difference with the built-in sass resolution logic and out resolution logic:
// First, we look at the files starting with `_`, then without `_` (i.e. `_name.sass`, `_name.scss`, `_name.css`, `name.sass`, `name.scss`, `name.css`),
// although `sass` look together by extensions (i.e. `_name.sass`/`name.sass`/`_name.scss`/`name.scss`/`_name.css`/`name.css`).
// It shouldn't be a problem because `sass` throw errors:
// - on having `_name.sass` and `name.sass` (extension can be `sass`, `scss` or `css`) in the same directory
// - on having `_name.sass` and `_name.scss` in the same directory
//
// Also `sass` prefer `sass`/`scss` over `css`.
const sassModuleResolve = promiseResolve(resolverFactory({
alias: [],
aliasFields: [],
conditionNames: [],
descriptionFiles: [],
extensions: [".sass", ".scss", ".css"],
exportsFields: [],
mainFields: [],
mainFiles: ["_index", "index"],
modules: [],
restrictions: [/\.((sa|sc|c)ss)$/i],
preferRelative: true
}));
const sassImportResolve = promiseResolve(resolverFactory({
alias: [],
aliasFields: [],
conditionNames: [],
descriptionFiles: [],
extensions: [".sass", ".scss", ".css"],
exportsFields: [],
mainFields: [],
mainFiles: ["_index.import", "_index", "index.import", "index"],
modules: [],
restrictions: [/\.((sa|sc|c)ss)$/i],
preferRelative: true
}));
const webpackModuleResolve = promiseResolve(resolverFactory({
dependencyType: "sass",
conditionNames: ["sass", "style", "..."],
mainFields: ["sass", "style", "main", "..."],
mainFiles: ["_index", "index", "..."],
extensions: [".sass", ".scss", ".css"],
restrictions: [/\.((sa|sc|c)ss)$/i],
preferRelative: true
}));
const webpackImportResolve = promiseResolve(resolverFactory({
dependencyType: "sass",
conditionNames: ["sass", "style", "..."],
mainFields: ["sass", "style", "main", "..."],
mainFiles: ["_index.import", "_index", "index.import", "index", "..."],
extensions: [".sass", ".scss", ".css"],
restrictions: [/\.((sa|sc|c)ss)$/i],
preferRelative: true
}));
return (context, request, fromImport) => {
// See https://github.com/webpack/webpack/issues/12340
// Because `node-sass` calls our importer before `1. Filesystem imports relative to the base file.`
// custom importer may not return `{ file: '/path/to/name.ext' }` and therefore our `context` will be relative
if (!isDartSass && !_path.default.isAbsolute(context)) {
return Promise.reject();
}
const originalRequest = request;
const isFileScheme = originalRequest.slice(0, 5).toLowerCase() === "file:";
if (isFileScheme) {
try {
// eslint-disable-next-line no-param-reassign
request = _url.default.fileURLToPath(originalRequest);
} catch (ignoreError) {
// eslint-disable-next-line no-param-reassign
request = request.slice(7);
}
}
let resolutionMap = [];
const needEmulateSassResolver =
// `sass` doesn't support module import
!IS_SPECIAL_MODULE_IMPORT.test(request) &&
// We need improve absolute paths handling.
// Absolute paths should be resolved:
// - Server-relative URLs - `<context>/path/to/file.ext` (where `<context>` is root context)
// - Absolute path - `/full/path/to/file.ext` or `C:\\full\path\to\file.ext`
!isFileScheme && !originalRequest.startsWith("/") && !IS_NATIVE_WIN32_PATH.test(originalRequest);
if (includePaths.length > 0 && needEmulateSassResolver) {
// The order of import precedence is as follows:
//
// 1. Filesystem imports relative to the base file.
// 2. Custom importer imports.
// 3. Filesystem imports relative to the working directory.
// 4. Filesystem imports relative to an `includePaths` path.
// 5. Filesystem imports relative to a `SASS_PATH` path.
//
// `sass` run custom importers before `3`, `4` and `5` points, we need to emulate this behavior to avoid wrong resolution.
const sassPossibleRequests = getPossibleRequests(request, false, fromImport);
// `node-sass` calls our importer before `1. Filesystem imports relative to the base file.`, so we need emulate this too
if (!isDartSass) {
resolutionMap = resolutionMap.concat({
resolve: fromImport ? sassImportResolve : sassModuleResolve,
context: _path.default.dirname(context),
possibleRequests: sassPossibleRequests
});
}
resolutionMap = resolutionMap.concat(
// eslint-disable-next-line no-shadow
includePaths.map(context => {
return {
resolve: fromImport ? sassImportResolve : sassModuleResolve,
context,
possibleRequests: sassPossibleRequests
};
}));
}
const webpackPossibleRequests = getPossibleRequests(request, true, fromImport);
resolutionMap = resolutionMap.concat({
resolve: fromImport ? webpackImportResolve : webpackModuleResolve,
context: _path.default.dirname(context),
possibleRequests: webpackPossibleRequests
});
return startResolving(resolutionMap);
};
}
const MATCH_CSS = /\.css$/i;
function getModernWebpackImporter() {
return {
async canonicalize() {
return null;
},
load() {
// TODO implement
}
};
}
function getWebpackImporter(loaderContext, implementation, includePaths) {
const resolve = getWebpackResolver(loaderContext.getResolve, implementation, includePaths);
return function importer(originalUrl, prev, done) {
const {
fromImport
} = this;
resolve(prev, originalUrl, fromImport).then(result => {
// Add the result as dependency.
// Although we're also using stats.includedFiles, this might come in handy when an error occurs.
// In this case, we don't get stats.includedFiles from node-sass/sass.
loaderContext.addDependency(_path.default.normalize(result));
// By removing the CSS file extension, we trigger node-sass to include the CSS file instead of just linking it.
done({
file: result.replace(MATCH_CSS, "")
});
})
// Catch all resolving errors, return the original file and pass responsibility back to other custom importers
.catch(() => {
done({
file: originalUrl
});
});
};
}
let nodeSassJobQueue = null;
/**
* Verifies that the implementation and version of Sass is supported by this loader.
*
* @param {Object} implementation
* @param {Object} options
* @returns {Function}
*/
function getCompileFn(implementation, options) {
const isNewSass = implementation.info.includes("dart-sass") || implementation.info.includes("sass-embedded");
if (isNewSass) {
if (options.api === "modern") {
return sassOptions => {
const {
data,
...rest
} = sassOptions;
return implementation.compileStringAsync(data, rest);
};
}
return sassOptions => new Promise((resolve, reject) => {
implementation.render(sassOptions, (error, result) => {
if (error) {
reject(error);
return;
}
resolve(result);
});
});
}
if (options.api === "modern") {
throw new Error("Modern API is not supported for 'node-sass'");
}
// There is an issue with node-sass when async custom importers are used
// See https://github.com/sass/node-sass/issues/857#issuecomment-93594360
// We need to use a job queue to make sure that one thread is always available to the UV lib
if (nodeSassJobQueue === null) {
const threadPoolSize = Number(process.env.UV_THREADPOOL_SIZE || 4);
// Only used for `node-sass`, so let's load it lazily
// eslint-disable-next-line global-require
const async = require("neo-async");
nodeSassJobQueue = async.queue(implementation.render.bind(implementation), threadPoolSize - 1);
}
return sassOptions => new Promise((resolve, reject) => {
nodeSassJobQueue.push.bind(nodeSassJobQueue)(sassOptions, (error, result) => {
if (error) {
reject(error);
return;
}
resolve(result);
});
});
}
const ABSOLUTE_SCHEME = /^[A-Za-z0-9+\-.]+:/;
/**
* @param {string} source
* @returns {"absolute" | "scheme-relative" | "path-absolute" | "path-absolute"}
*/
function getURLType(source) {
if (source[0] === "/") {
if (source[1] === "/") {
return "scheme-relative";
}
return "path-absolute";
}
if (IS_NATIVE_WIN32_PATH.test(source)) {
return "path-absolute";
}
return ABSOLUTE_SCHEME.test(source) ? "absolute" : "path-relative";
}
function normalizeSourceMap(map, rootContext) {
const newMap = map;
// result.map.file is an optional property that provides the output filename.
// Since we don't know the final filename in the webpack build chain yet, it makes no sense to have it.
// eslint-disable-next-line no-param-reassign
if (typeof newMap.file !== "undefined") {
delete newMap.file;
}
// eslint-disable-next-line no-param-reassign
newMap.sourceRoot = "";
// node-sass returns POSIX paths, that's why we need to transform them back to native paths.
// This fixes an error on windows where the source-map module cannot resolve the source maps.
// @see https://github.com/webpack-contrib/sass-loader/issues/366#issuecomment-279460722
// eslint-disable-next-line no-param-reassign
newMap.sources = newMap.sources.map(source => {
const sourceType = getURLType(source);
// Do no touch `scheme-relative`, `path-absolute` and `absolute` types (except `file:`)
if (sourceType === "absolute" && /^file:/i.test(source)) {
return _url.default.fileURLToPath(source);
} else if (sourceType === "path-relative") {
return _path.default.resolve(rootContext, _path.default.normalize(source));
}
return source;
});
return newMap;
}
function errorFactory(error) {
let message;
if (error.formatted) {
message = error.formatted.replace(/^Error: /, "");
} else {
// Keep original error if `sassError.formatted` is unavailable
({
message
} = error);
}
const obj = new Error(message, {
cause: error
});
obj.stack = null;
return obj;
}

15
node_modules/sass-loader/node_modules/.bin/sass generated vendored Normal file
View File

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../../../sass/sass.js" "$@"
ret=$?
else
node "$basedir/../../../sass/sass.js" "$@"
ret=$?
fi
exit $ret

7
node_modules/sass-loader/node_modules/.bin/sass.cmd generated vendored Normal file
View File

@ -0,0 +1,7 @@
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\..\..\sass\sass.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\..\..\sass\sass.js" %*
)

146
node_modules/sass-loader/package.json generated vendored Normal file
View File

@ -0,0 +1,146 @@
{
"_from": "sass-loader@13.3.2",
"_id": "sass-loader@13.3.2",
"_inBundle": false,
"_integrity": "sha512-CQbKl57kdEv+KDLquhC+gE3pXt74LEAzm+tzywcA0/aHZuub8wTErbjAoNI57rPUWRYRNC5WUnNl8eGJNbDdwg==",
"_location": "/sass-loader",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "sass-loader@13.3.2",
"name": "sass-loader",
"escapedName": "sass-loader",
"rawSpec": "13.3.2",
"saveSpec": null,
"fetchSpec": "13.3.2"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-13.3.2.tgz",
"_shasum": "460022de27aec772480f03de17f5ba88fa7e18c6",
"_spec": "sass-loader@13.3.2",
"_where": "C:\\Users\\zhouxueli\\Desktop\\scheduling-app",
"author": {
"name": "J. Tangelder"
},
"bugs": {
"url": "https://github.com/webpack-contrib/sass-loader/issues"
},
"bundleDependencies": false,
"dependencies": {
"neo-async": "^2.6.2"
},
"deprecated": false,
"description": "Sass loader for webpack",
"devDependencies": {
"@babel/cli": "^7.21.5",
"@babel/core": "^7.21.5",
"@babel/preset-env": "^7.21.5",
"@commitlint/cli": "^17.6.1",
"@commitlint/config-conventional": "^17.6.1",
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
"babel-jest": "^29.5.0",
"bootstrap-sass": "^3.4.1",
"bootstrap-v4": "npm:bootstrap@^4.5.3",
"bootstrap-v5": "npm:bootstrap@^5.0.1",
"cross-env": "^7.0.3",
"cspell": "^6.31.1",
"css-loader": "^6.7.3",
"del": "^6.1.1",
"del-cli": "^4.0.1",
"enhanced-resolve": "^5.13.0",
"eslint": "^8.39.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"fibers": "^5.0.3",
"file-loader": "^6.2.0",
"foundation-sites": "^6.7.5",
"husky": "^8.0.3",
"jest": "^29.5.0",
"jest-environment-node-single-context": "^29.0.0",
"lint-staged": "^13.2.2",
"material-components-web": "^9.0.0",
"memfs": "^3.5.1",
"node-sass": "^8.0.0",
"node-sass-glob-importer": "^5.3.2",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.8",
"sass": "^1.62.1",
"sass-embedded": "^1.62.0",
"semver": "^7.5.0",
"standard-version": "^9.3.1",
"style-loader": "^3.3.2",
"webpack": "^5.81.0"
},
"engines": {
"node": ">= 14.15.0"
},
"files": [
"dist"
],
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/webpack"
},
"homepage": "https://github.com/webpack-contrib/sass-loader",
"keywords": [
"sass",
"libsass",
"webpack",
"loader"
],
"license": "MIT",
"main": "dist/cjs.js",
"name": "sass-loader",
"peerDependencies": {
"fibers": ">= 3.1.0",
"node-sass": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0",
"sass": "^1.3.0",
"sass-embedded": "*",
"webpack": "^5.0.0"
},
"peerDependenciesMeta": {
"node-sass": {
"optional": true
},
"sass": {
"optional": true
},
"sass-embedded": {
"optional": true
},
"fibers": {
"optional": true
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/webpack-contrib/sass-loader.git"
},
"scripts": {
"build": "cross-env NODE_ENV=production babel src -d dist --copy-files",
"clean": "del-cli dist",
"commitlint": "commitlint --from=master",
"fix": "npm-run-all -l fix:js fix:prettier",
"fix:js": "npm run lint:js -- --fix",
"fix:prettier": "npm run lint:prettier -- --write",
"lint": "npm-run-all -l -p \"lint:**\"",
"lint:js": "eslint --cache .",
"lint:prettier": "prettier --list-different .",
"lint:spelling": "cspell \"**/*.*\"",
"prebuild": "npm run clean",
"prepare": "husky install && npm run build",
"pretest": "npm run lint",
"release": "standard-version",
"security": "npm audit --production",
"start": "npm run build -- -w",
"test": "npm run test:coverage",
"test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
"test:manual": "npm run build && webpack-dev-server test/manual/src/index.js --open --config test/manual/webpack.config.js",
"test:only": "cross-env NODE_ENV=test jest",
"test:watch": "npm run test:only -- --watch"
},
"version": "13.3.2"
}