update, text, response

This commit is contained in:
2025-11-02 11:09:14 +01:00
parent 14776c86b0
commit eed8a4ddcf
2794 changed files with 156786 additions and 129204 deletions

117
node_modules/gulp-sass/index.js generated vendored
View File

@@ -24,40 +24,57 @@ const transfob = (transform) => new Transform({ transform, objectMode: true });
/**
* Handles returning the file to the stream
*/
const filePush = (file, sassObject, callback) => {
// Build Source Maps!
if (sassObject.map) {
// Transform map into JSON
const sassMap = JSON.parse(sassObject.map.toString());
// Grab the stdout and transform it into stdin
const sassMapFile = sassMap.file.replace(/^stdout$/, 'stdin');
// Grab the base filename that's being worked on
const sassFileSrc = file.relative;
// Grab the path portion of the file that's being worked on
const sassFileSrcPath = path.dirname(sassFileSrc);
const filePush = (file, compileResult, callback) => {
file.contents = Buffer.from(compileResult.css);
file.path = replaceExtension(file.path, '.css');
if (sassFileSrcPath) {
const sourceFileIndex = sassMap.sources.indexOf(sassMapFile);
// Prepend the path to all files in the sources array except the file that's being worked on
sassMap.sources = sassMap.sources.map((source, index) => (
index === sourceFileIndex
? source
: path.join(sassFileSrcPath, source)
));
// Build Source Maps!
if (compileResult.sourceMap) {
const proto = /^file:\/\/?/;
const leadingSlash = /^\//;
const sassMap = compileResult.sourceMap;
const base = path.resolve(file.cwd, file.base);
if (!sassMap.file) {
// Convert from absolute path to relative as in gulp-sass 5.0.0
sassMap.file = file.history[0]
.replace(base + path.sep, '')
.replace(proto, '');
}
// Remove 'stdin' from souces and replace with filenames!
sassMap.sources = sassMap.sources.filter((src) => src !== 'stdin' && src);
// Transform to relative file paths as in gulp-sass 5.0.0
sassMap.sources = sassMap.sources.map((src) => {
// file uses Windows-style path separators, source is a URL.
const baseUri = base.replace(/\\/g, '/');
// The current file and its content is included
// as data:<encoded file contents> in the new Sass JS API.
// Map it to the original file name (first history entry).
if (src.startsWith('data:')) {
return file.history[0]
.replace(/\\/g, '/')
.replace(`${baseUri}/`, '')
.replace(proto, '')
.replace(leadingSlash, '');
}
return src
.replace(proto, '')
.replace(`${baseUri}/`, '')
.replace(leadingSlash, '');
});
// Grab the base filename that's being worked on
const sassFileSrc = file.relative;
// Replace the map file with the original filename (but new extension)
sassMap.file = replaceExtension(sassFileSrc, '.css');
if (file.sourceMap.sourcesContent && !sassMap.sourcesContent) {
sassMap.sourcesContent = file.sourceMap.sourcesContent;
}
// Apply the map
applySourceMap(file, sassMap);
}
file.contents = sassObject.css;
file.path = replaceExtension(file.path, '.css');
if (file.stat) {
file.stat.atime = file.stat.mtime = file.stat.ctime = new Date();
}
@@ -71,7 +88,7 @@ const filePush = (file, sassObject, callback) => {
const handleError = (error, file, callback) => {
const filePath = (error.file === 'stdin' ? file.path : error.file) || file.path;
const relativePath = path.relative(process.cwd(), filePath);
const message = `${picocolors.underline(relativePath)}\n${error.formatted}`;
const message = `${picocolors.underline(relativePath)}\n${error.message}`;
error.messageFormatted = message;
error.messageOriginal = error.message;
@@ -110,52 +127,48 @@ const gulpSass = (options, sync) => {
}
const opts = clonedeep(options || {});
opts.data = file.contents.toString();
// We set the file path here so that libsass can correctly resolve import paths
opts.file = file.path;
// Ensure `indentedSyntax` is true if a `.sass` file
// Ensure `indented` if a `.sass` file
if (path.extname(file.path) === '.sass') {
opts.indentedSyntax = true;
opts.syntax = 'indented';
}
// Ensure file's parent directory in the include path
if (opts.includePaths) {
if (typeof opts.includePaths === 'string') {
opts.includePaths = [opts.includePaths];
if (opts.loadPaths) {
if (typeof opts.loadPaths === 'string') {
opts.loadPaths = [opts.loadPaths];
}
} else {
opts.includePaths = [];
opts.loadPaths = [];
}
opts.includePaths.unshift(path.dirname(file.path));
opts.loadPaths.unshift(path.dirname(file.path));
// Generate Source Maps if the source-map plugin is present
if (file.sourceMap) {
opts.sourceMap = file.path;
opts.omitSourceMapUrl = true;
opts.sourceMapContents = true;
opts.sourceMap = true;
opts.sourceMapIncludeSources = true;
}
const fileContents = file.contents.toString();
if (sync !== true) {
/**
* Async Sass render
* Async Sass compile
*/
gulpSass.compiler.render(opts, (error, obj) => {
if (error) {
gulpSass.compiler
.compileStringAsync(fileContents, opts)
.then((compileResult) => {
filePush(file, compileResult, callback);
})
.catch((error) => {
handleError(error, file, callback);
return;
}
filePush(file, obj, callback);
});
});
} else {
/**
* Sync Sass render
* Sync Sass compile
*/
try {
filePush(file, gulpSass.compiler.renderSync(opts), callback);
filePush(file, gulpSass.compiler.compileString(fileContents, opts), callback);
} catch (error) {
handleError(error, file, callback);
}
@@ -164,7 +177,7 @@ const gulpSass = (options, sync) => {
};
/**
* Sync Sass render
* Sync Sass compile
*/
gulpSass.sync = (options) => gulpSass(options, true);
@@ -172,13 +185,13 @@ gulpSass.sync = (options) => gulpSass(options, true);
* Log errors nicely
*/
gulpSass.logError = function logError(error) {
const message = new PluginError('sass', error.messageFormatted).toString();
const message = new PluginError('sass', error).toString();
process.stderr.write(`${message}\n`);
this.emit('end');
};
module.exports = (compiler) => {
if (!compiler || !compiler.render) {
if (!compiler || !compiler.compile) {
const message = new PluginError(
PLUGIN_NAME,
MISSING_COMPILER_MESSAGE,