rearrage_stuff
This commit is contained in:
26
node_modules/sass-embedded/dist/bin/sass.js
generated
vendored
Normal file
26
node_modules/sass-embedded/dist/bin/sass.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const child_process = require("child_process");
|
||||
const path = require("path");
|
||||
const compiler_path_1 = require("../lib/src/compiler-path");
|
||||
// TODO npm/cmd-shim#152 and yarnpkg/berry#6422 - If and when the package
|
||||
// managers support it, we should make this a proper shell script rather than a
|
||||
// JS wrapper.
|
||||
try {
|
||||
child_process.execFileSync(compiler_path_1.compilerCommand[0], [...compiler_path_1.compilerCommand.slice(1), ...process.argv.slice(2)], {
|
||||
// Node blocks launching .bat and .cmd without a shell due to CVE-2024-27980
|
||||
shell: ['.bat', '.cmd'].includes(path.extname(compiler_path_1.compilerCommand[0]).toLowerCase()),
|
||||
stdio: 'inherit',
|
||||
windowsHide: true,
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
if (error.code) {
|
||||
throw error;
|
||||
}
|
||||
else {
|
||||
process.exitCode = error.status;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=sass.js.map
|
||||
1
node_modules/sass-embedded/dist/bin/sass.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/bin/sass.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"sass.js","sourceRoot":"","sources":["../../bin/sass.ts"],"names":[],"mappings":";;;AAEA,+CAA+C;AAC/C,6BAA6B;AAC7B,4DAAyD;AAEzD,yEAAyE;AACzE,+EAA+E;AAC/E,cAAc;AAEd,IAAI,CAAC;IACH,aAAa,CAAC,YAAY,CACxB,+BAAe,CAAC,CAAC,CAAC,EAClB,CAAC,GAAG,+BAAe,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACvD;QACE,4EAA4E;QAC5E,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,QAAQ,CAC9B,IAAI,CAAC,OAAO,CAAC,+BAAe,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAC/C;QACD,KAAK,EAAE,SAAS;QAChB,WAAW,EAAE,IAAI;KAClB,CACF,CAAC;AACJ,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QACf,MAAM,KAAK,CAAC;IACd,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC;IAClC,CAAC;AACH,CAAC"}
|
||||
9
node_modules/sass-embedded/dist/jest.config.js
generated
vendored
Normal file
9
node_modules/sass-embedded/dist/jest.config.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const config = {
|
||||
roots: ['<rootDir>/lib/', '<rootDir>/test/'],
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
};
|
||||
exports.default = config;
|
||||
//# sourceMappingURL=jest.config.js.map
|
||||
1
node_modules/sass-embedded/dist/jest.config.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/jest.config.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"jest.config.js","sourceRoot":"","sources":["../jest.config.ts"],"names":[],"mappings":";;AAAA,MAAM,MAAM,GAAG;IACb,KAAK,EAAE,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;IAC5C,MAAM,EAAE,SAAS;IACjB,eAAe,EAAE,MAAM;CACxB,CAAC;AAEF,kBAAe,MAAM,CAAC"}
|
||||
67
node_modules/sass-embedded/dist/lib/index.js
generated
vendored
Normal file
67
node_modules/sass-embedded/dist/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
"use strict";
|
||||
// Copyright 2021 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NULL = exports.FALSE = exports.TRUE = exports.Logger = exports.info = exports.renderSync = exports.render = exports.Version = exports.deprecations = exports.Compiler = exports.initCompiler = exports.AsyncCompiler = exports.initAsyncCompiler = exports.NodePackageImporter = exports.compileStringAsync = exports.compileAsync = exports.compileString = exports.compile = exports.Exception = exports.types = exports.SassCalculation = exports.CalculationInterpolation = exports.CalculationOperation = exports.sassNull = exports.Value = exports.SassString = exports.SassNumber = exports.SassMixin = exports.SassMap = exports.SassFunction = exports.SassColor = exports.sassTrue = exports.sassFalse = exports.SassBoolean = exports.SassArgumentList = exports.SassList = void 0;
|
||||
const pkg = require("../package.json");
|
||||
const boolean_1 = require("./src/value/boolean");
|
||||
const null_1 = require("./src/value/null");
|
||||
var list_1 = require("./src/value/list");
|
||||
Object.defineProperty(exports, "SassList", { enumerable: true, get: function () { return list_1.SassList; } });
|
||||
var argument_list_1 = require("./src/value/argument-list");
|
||||
Object.defineProperty(exports, "SassArgumentList", { enumerable: true, get: function () { return argument_list_1.SassArgumentList; } });
|
||||
var boolean_2 = require("./src/value/boolean");
|
||||
Object.defineProperty(exports, "SassBoolean", { enumerable: true, get: function () { return boolean_2.SassBoolean; } });
|
||||
Object.defineProperty(exports, "sassFalse", { enumerable: true, get: function () { return boolean_2.sassFalse; } });
|
||||
Object.defineProperty(exports, "sassTrue", { enumerable: true, get: function () { return boolean_2.sassTrue; } });
|
||||
var color_1 = require("./src/value/color");
|
||||
Object.defineProperty(exports, "SassColor", { enumerable: true, get: function () { return color_1.SassColor; } });
|
||||
var function_1 = require("./src/value/function");
|
||||
Object.defineProperty(exports, "SassFunction", { enumerable: true, get: function () { return function_1.SassFunction; } });
|
||||
var map_1 = require("./src/value/map");
|
||||
Object.defineProperty(exports, "SassMap", { enumerable: true, get: function () { return map_1.SassMap; } });
|
||||
var mixin_1 = require("./src/value/mixin");
|
||||
Object.defineProperty(exports, "SassMixin", { enumerable: true, get: function () { return mixin_1.SassMixin; } });
|
||||
var number_1 = require("./src/value/number");
|
||||
Object.defineProperty(exports, "SassNumber", { enumerable: true, get: function () { return number_1.SassNumber; } });
|
||||
var string_1 = require("./src/value/string");
|
||||
Object.defineProperty(exports, "SassString", { enumerable: true, get: function () { return string_1.SassString; } });
|
||||
var value_1 = require("./src/value");
|
||||
Object.defineProperty(exports, "Value", { enumerable: true, get: function () { return value_1.Value; } });
|
||||
var null_2 = require("./src/value/null");
|
||||
Object.defineProperty(exports, "sassNull", { enumerable: true, get: function () { return null_2.sassNull; } });
|
||||
var calculations_1 = require("./src/value/calculations");
|
||||
Object.defineProperty(exports, "CalculationOperation", { enumerable: true, get: function () { return calculations_1.CalculationOperation; } });
|
||||
Object.defineProperty(exports, "CalculationInterpolation", { enumerable: true, get: function () { return calculations_1.CalculationInterpolation; } });
|
||||
Object.defineProperty(exports, "SassCalculation", { enumerable: true, get: function () { return calculations_1.SassCalculation; } });
|
||||
exports.types = require("./src/legacy/value");
|
||||
var exception_1 = require("./src/exception");
|
||||
Object.defineProperty(exports, "Exception", { enumerable: true, get: function () { return exception_1.Exception; } });
|
||||
var compile_1 = require("./src/compile");
|
||||
Object.defineProperty(exports, "compile", { enumerable: true, get: function () { return compile_1.compile; } });
|
||||
Object.defineProperty(exports, "compileString", { enumerable: true, get: function () { return compile_1.compileString; } });
|
||||
Object.defineProperty(exports, "compileAsync", { enumerable: true, get: function () { return compile_1.compileAsync; } });
|
||||
Object.defineProperty(exports, "compileStringAsync", { enumerable: true, get: function () { return compile_1.compileStringAsync; } });
|
||||
Object.defineProperty(exports, "NodePackageImporter", { enumerable: true, get: function () { return compile_1.NodePackageImporter; } });
|
||||
var async_1 = require("./src/compiler/async");
|
||||
Object.defineProperty(exports, "initAsyncCompiler", { enumerable: true, get: function () { return async_1.initAsyncCompiler; } });
|
||||
Object.defineProperty(exports, "AsyncCompiler", { enumerable: true, get: function () { return async_1.AsyncCompiler; } });
|
||||
var sync_1 = require("./src/compiler/sync");
|
||||
Object.defineProperty(exports, "initCompiler", { enumerable: true, get: function () { return sync_1.initCompiler; } });
|
||||
Object.defineProperty(exports, "Compiler", { enumerable: true, get: function () { return sync_1.Compiler; } });
|
||||
var deprecations_1 = require("./src/deprecations");
|
||||
Object.defineProperty(exports, "deprecations", { enumerable: true, get: function () { return deprecations_1.deprecations; } });
|
||||
var version_1 = require("./src/version");
|
||||
Object.defineProperty(exports, "Version", { enumerable: true, get: function () { return version_1.Version; } });
|
||||
var legacy_1 = require("./src/legacy");
|
||||
Object.defineProperty(exports, "render", { enumerable: true, get: function () { return legacy_1.render; } });
|
||||
Object.defineProperty(exports, "renderSync", { enumerable: true, get: function () { return legacy_1.renderSync; } });
|
||||
exports.info = `sass-embedded\t${pkg.version}`;
|
||||
var logger_1 = require("./src/logger");
|
||||
Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return logger_1.Logger; } });
|
||||
// Legacy JS API
|
||||
exports.TRUE = boolean_1.sassTrue;
|
||||
exports.FALSE = boolean_1.sassFalse;
|
||||
exports.NULL = null_1.sassNull;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/index.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,uCAAuC;AACvC,iDAAwD;AACxD,2CAA0C;AAE1C,yCAAyD;AAAlC,gGAAA,QAAQ,OAAA;AAC/B,2DAA2D;AAAnD,iHAAA,gBAAgB,OAAA;AACxB,+CAAqE;AAA7D,sGAAA,WAAW,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,mGAAA,QAAQ,OAAA;AACxC,2CAA4C;AAApC,kGAAA,SAAS,OAAA;AACjB,iDAAkD;AAA1C,wGAAA,YAAY,OAAA;AACpB,uCAAwC;AAAhC,8FAAA,OAAO,OAAA;AACf,2CAA4C;AAApC,kGAAA,SAAS,OAAA;AACjB,6CAA8C;AAAtC,oGAAA,UAAU,OAAA;AAClB,6CAA8C;AAAtC,oGAAA,UAAU,OAAA;AAClB,qCAAkC;AAA1B,8FAAA,KAAK,OAAA;AACb,yCAA0C;AAAlC,gGAAA,QAAQ,OAAA;AAChB,yDAKkC;AAJhC,oHAAA,oBAAoB,OAAA;AAEpB,wHAAA,wBAAwB,OAAA;AACxB,+GAAA,eAAe,OAAA;AAGjB,8CAA4C;AAC5C,6CAA0C;AAAlC,sGAAA,SAAS,OAAA;AACjB,yCAMuB;AALrB,kGAAA,OAAO,OAAA;AACP,wGAAA,aAAa,OAAA;AACb,uGAAA,YAAY,OAAA;AACZ,6GAAA,kBAAkB,OAAA;AAClB,8GAAA,mBAAmB,OAAA;AAErB,8CAAsE;AAA9D,0GAAA,iBAAiB,OAAA;AAAE,sGAAA,aAAa,OAAA;AACxC,4CAA2D;AAAnD,oGAAA,YAAY,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAC9B,mDAK4B;AAJ1B,4GAAA,YAAY,OAAA;AAKd,yCAAsC;AAA9B,kGAAA,OAAO,OAAA;AACf,uCAAgD;AAAxC,gGAAA,MAAM,OAAA;AAAE,oGAAA,UAAU,OAAA;AAEb,QAAA,IAAI,GAAG,kBAAkB,GAAG,CAAC,OAAO,EAAE,CAAC;AAEpD,uCAAoC;AAA5B,gGAAA,MAAM,OAAA;AAEd,gBAAgB;AAEH,QAAA,IAAI,GAAG,kBAAQ,CAAC;AAChB,QAAA,KAAK,GAAG,mBAAS,CAAC;AAClB,QAAA,IAAI,GAAG,eAAQ,CAAC"}
|
||||
215
node_modules/sass-embedded/dist/lib/index.mjs
generated
vendored
Normal file
215
node_modules/sass-embedded/dist/lib/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,215 @@
|
||||
import * as sass from './index.js';
|
||||
|
||||
export const compile = sass.compile;
|
||||
export const compileAsync = sass.compileAsync;
|
||||
export const compileString = sass.compileString;
|
||||
export const compileStringAsync = sass.compileStringAsync;
|
||||
export const NodePackageImporter = sass.NodePackageImporter;
|
||||
export const AsyncCompiler = sass.AsyncCompiler;
|
||||
export const Compiler = sass.Compiler;
|
||||
export const initAsyncCompiler = sass.initAsyncCompiler;
|
||||
export const initCompiler = sass.initCompiler;
|
||||
export const deprecations = sass.deprecations;
|
||||
export const Version = sass.Version;
|
||||
export const Logger = sass.Logger;
|
||||
export const CalculationInterpolation = sass.CalculationInterpolation;
|
||||
export const CalculationOperation = sass.CalculationOperation;
|
||||
export const CalculationOperator = sass.CalculationOperator;
|
||||
export const SassArgumentList = sass.SassArgumentList;
|
||||
export const SassBoolean = sass.SassBoolean;
|
||||
export const SassCalculation = sass.SassCalculation;
|
||||
export const SassColor = sass.SassColor;
|
||||
export const SassFunction = sass.SassFunction;
|
||||
export const SassMixin = sass.SassMixin;
|
||||
export const SassList = sass.SassList;
|
||||
export const SassMap = sass.SassMap;
|
||||
export const SassNumber = sass.SassNumber;
|
||||
export const SassString = sass.SassString;
|
||||
export const Value = sass.Value;
|
||||
export const CustomFunction = sass.CustomFunction;
|
||||
export const ListSeparator = sass.ListSeparator;
|
||||
export const sassFalse = sass.sassFalse;
|
||||
export const sassNull = sass.sassNull;
|
||||
export const sassTrue = sass.sassTrue;
|
||||
export const Exception = sass.Exception;
|
||||
export const PromiseOr = sass.PromiseOr;
|
||||
export const info = sass.info;
|
||||
export const render = sass.render;
|
||||
export const renderSync = sass.renderSync;
|
||||
export const TRUE = sass.TRUE;
|
||||
export const FALSE = sass.FALSE;
|
||||
export const NULL = sass.NULL;
|
||||
export const types = sass.types;
|
||||
|
||||
let printedDefaultExportDeprecation = false;
|
||||
function defaultExportDeprecation() {
|
||||
if (printedDefaultExportDeprecation) return;
|
||||
printedDefaultExportDeprecation = true;
|
||||
console.error(
|
||||
"`import sass from 'sass'` is deprecated.\n" +
|
||||
"Please use `import * as sass from 'sass'` instead."
|
||||
);
|
||||
}
|
||||
|
||||
export default {
|
||||
get compile() {
|
||||
defaultExportDeprecation();
|
||||
return sass.compile;
|
||||
},
|
||||
get compileAsync() {
|
||||
defaultExportDeprecation();
|
||||
return sass.compileAsync;
|
||||
},
|
||||
get compileString() {
|
||||
defaultExportDeprecation();
|
||||
return sass.compileString;
|
||||
},
|
||||
get compileStringAsync() {
|
||||
defaultExportDeprecation();
|
||||
return sass.compileStringAsync;
|
||||
},
|
||||
get NodePackageImporter() {
|
||||
defaultExportDeprecation();
|
||||
return sass.NodePackageImporter;
|
||||
},
|
||||
get initAsyncCompiler() {
|
||||
defaultExportDeprecation();
|
||||
return sass.initAsyncCompiler;
|
||||
},
|
||||
get initCompiler() {
|
||||
defaultExportDeprecation();
|
||||
return sass.initCompiler;
|
||||
},
|
||||
get AsyncCompiler() {
|
||||
defaultExportDeprecation();
|
||||
return sass.AsyncCompiler;
|
||||
},
|
||||
get Compiler() {
|
||||
defaultExportDeprecation();
|
||||
return sass.Compiler;
|
||||
},
|
||||
get deprecations() {
|
||||
defaultExportDeprecation();
|
||||
return sass.deprecations;
|
||||
},
|
||||
get Version() {
|
||||
defaultExportDeprecation();
|
||||
return sass.Version;
|
||||
},
|
||||
get Logger() {
|
||||
defaultExportDeprecation();
|
||||
return sass.Logger;
|
||||
},
|
||||
get CalculationOperation() {
|
||||
defaultExportDeprecation();
|
||||
return sass.CalculationOperation;
|
||||
},
|
||||
get CalculationOperator() {
|
||||
defaultExportDeprecation();
|
||||
return sass.CalculationOperator;
|
||||
},
|
||||
get CalculationInterpolation() {
|
||||
defaultExportDeprecation();
|
||||
return sass.CalculationInterpolation;
|
||||
},
|
||||
get SassArgumentList() {
|
||||
defaultExportDeprecation();
|
||||
return sass.SassArgumentList;
|
||||
},
|
||||
get SassBoolean() {
|
||||
defaultExportDeprecation();
|
||||
return sass.SassBoolean;
|
||||
},
|
||||
get SassCalculation() {
|
||||
defaultExportDeprecation();
|
||||
return sass.SassCalculation;
|
||||
},
|
||||
get SassColor() {
|
||||
defaultExportDeprecation();
|
||||
return sass.SassColor;
|
||||
},
|
||||
get SassFunction() {
|
||||
defaultExportDeprecation();
|
||||
return sass.SassFunction;
|
||||
},
|
||||
get SassMixin() {
|
||||
defaultExportDeprecation();
|
||||
return sass.SassMixin;
|
||||
},
|
||||
get SassList() {
|
||||
defaultExportDeprecation();
|
||||
return sass.SassList;
|
||||
},
|
||||
get SassMap() {
|
||||
defaultExportDeprecation();
|
||||
return sass.SassMap;
|
||||
},
|
||||
get SassNumber() {
|
||||
defaultExportDeprecation();
|
||||
return sass.SassNumber;
|
||||
},
|
||||
get SassString() {
|
||||
defaultExportDeprecation();
|
||||
return sass.SassString;
|
||||
},
|
||||
get Value() {
|
||||
defaultExportDeprecation();
|
||||
return sass.Value;
|
||||
},
|
||||
get CustomFunction() {
|
||||
defaultExportDeprecation();
|
||||
return sass.CustomFunction;
|
||||
},
|
||||
get ListSeparator() {
|
||||
defaultExportDeprecation();
|
||||
return sass.ListSeparator;
|
||||
},
|
||||
get sassFalse() {
|
||||
defaultExportDeprecation();
|
||||
return sass.sassFalse;
|
||||
},
|
||||
get sassNull() {
|
||||
defaultExportDeprecation();
|
||||
return sass.sassNull;
|
||||
},
|
||||
get sassTrue() {
|
||||
defaultExportDeprecation();
|
||||
return sass.sassTrue;
|
||||
},
|
||||
get Exception() {
|
||||
defaultExportDeprecation();
|
||||
return sass.Exception;
|
||||
},
|
||||
get PromiseOr() {
|
||||
defaultExportDeprecation();
|
||||
return sass.PromiseOr;
|
||||
},
|
||||
get info() {
|
||||
defaultExportDeprecation();
|
||||
return sass.info;
|
||||
},
|
||||
get render() {
|
||||
defaultExportDeprecation();
|
||||
return sass.render;
|
||||
},
|
||||
get renderSync() {
|
||||
defaultExportDeprecation();
|
||||
return sass.renderSync;
|
||||
},
|
||||
get TRUE() {
|
||||
defaultExportDeprecation();
|
||||
return sass.TRUE;
|
||||
},
|
||||
get FALSE() {
|
||||
defaultExportDeprecation();
|
||||
return sass.FALSE;
|
||||
},
|
||||
get NULL() {
|
||||
defaultExportDeprecation();
|
||||
return sass.NULL;
|
||||
},
|
||||
get types() {
|
||||
defaultExportDeprecation();
|
||||
return sass.types;
|
||||
},
|
||||
};
|
||||
31
node_modules/sass-embedded/dist/lib/src/canonicalize-context.js
generated
vendored
Normal file
31
node_modules/sass-embedded/dist/lib/src/canonicalize-context.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
// Copyright 2024 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CanonicalizeContext = void 0;
|
||||
class CanonicalizeContext {
|
||||
fromImport;
|
||||
_containingUrl;
|
||||
get containingUrl() {
|
||||
this._containingUrlAccessed = true;
|
||||
return this._containingUrl;
|
||||
}
|
||||
_containingUrlAccessed = false;
|
||||
/**
|
||||
* Whether the `containingUrl` getter has been accessed.
|
||||
*
|
||||
* This is marked as public so that the importer registry can access it, but
|
||||
* it's not part of the package's public API and should not be accessed by
|
||||
* user code. It may be renamed or removed without warning in the future.
|
||||
*/
|
||||
get containingUrlAccessed() {
|
||||
return this._containingUrlAccessed;
|
||||
}
|
||||
constructor(containingUrl, fromImport) {
|
||||
this._containingUrl = containingUrl;
|
||||
this.fromImport = fromImport;
|
||||
}
|
||||
}
|
||||
exports.CanonicalizeContext = CanonicalizeContext;
|
||||
//# sourceMappingURL=canonicalize-context.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/canonicalize-context.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/canonicalize-context.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"canonicalize-context.js","sourceRoot":"","sources":["../../../lib/src/canonicalize-context.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,MAAa,mBAAmB;IACrB,UAAU,CAAU;IAEZ,cAAc,CAAa;IAE5C,IAAI,aAAa;QACf,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC;QACnC,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAEO,sBAAsB,GAAG,KAAK,CAAC;IAEvC;;;;;;OAMG;IACH,IAAI,qBAAqB;QACvB,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACrC,CAAC;IAED,YAAY,aAAyB,EAAE,UAAmB;QACxD,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF;AA3BD,kDA2BC"}
|
||||
51
node_modules/sass-embedded/dist/lib/src/compile.js
generated
vendored
Normal file
51
node_modules/sass-embedded/dist/lib/src/compile.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
// Copyright 2020 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NodePackageImporter = void 0;
|
||||
exports.compile = compile;
|
||||
exports.compileString = compileString;
|
||||
exports.compileAsync = compileAsync;
|
||||
exports.compileStringAsync = compileStringAsync;
|
||||
const async_1 = require("./compiler/async");
|
||||
const sync_1 = require("./compiler/sync");
|
||||
var importer_registry_1 = require("./importer-registry");
|
||||
Object.defineProperty(exports, "NodePackageImporter", { enumerable: true, get: function () { return importer_registry_1.NodePackageImporter; } });
|
||||
function compile(path, options) {
|
||||
const compiler = (0, sync_1.initCompiler)();
|
||||
try {
|
||||
return compiler.compile(path, options);
|
||||
}
|
||||
finally {
|
||||
compiler.dispose();
|
||||
}
|
||||
}
|
||||
function compileString(source, options) {
|
||||
const compiler = (0, sync_1.initCompiler)();
|
||||
try {
|
||||
return compiler.compileString(source, options);
|
||||
}
|
||||
finally {
|
||||
compiler.dispose();
|
||||
}
|
||||
}
|
||||
async function compileAsync(path, options) {
|
||||
const compiler = await (0, async_1.initAsyncCompiler)();
|
||||
try {
|
||||
return await compiler.compileAsync(path, options);
|
||||
}
|
||||
finally {
|
||||
await compiler.dispose();
|
||||
}
|
||||
}
|
||||
async function compileStringAsync(source, options) {
|
||||
const compiler = await (0, async_1.initAsyncCompiler)();
|
||||
try {
|
||||
return await compiler.compileStringAsync(source, options);
|
||||
}
|
||||
finally {
|
||||
await compiler.dispose();
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=compile.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/compile.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/compile.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../../lib/src/compile.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AASvC,0BAUC;AAED,sCAUC;AAED,oCAUC;AAED,gDAUC;AArDD,4CAAmD;AAEnD,0CAA6C;AAG7C,yDAAwD;AAAhD,wHAAA,mBAAmB,OAAA;AAE3B,SAAgB,OAAO,CACrB,IAAY,EACZ,OAAmC;IAEnC,MAAM,QAAQ,GAAG,IAAA,mBAAY,GAAE,CAAC;IAChC,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;YAAS,CAAC;QACT,QAAQ,CAAC,OAAO,EAAE,CAAC;IACrB,CAAC;AACH,CAAC;AAED,SAAgB,aAAa,CAC3B,MAAc,EACd,OAAyC;IAEzC,MAAM,QAAQ,GAAG,IAAA,mBAAY,GAAE,CAAC;IAChC,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;YAAS,CAAC;QACT,QAAQ,CAAC,OAAO,EAAE,CAAC;IACrB,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,YAAY,CAChC,IAAY,EACZ,OAAoC;IAEpC,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAiB,GAAE,CAAC;IAC3C,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;YAAS,CAAC;QACT,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,kBAAkB,CACtC,MAAc,EACd,OAA0C;IAE1C,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAiB,GAAE,CAAC;IAC3C,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;YAAS,CAAC;QACT,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;AACH,CAAC"}
|
||||
31
node_modules/sass-embedded/dist/lib/src/compiler-module.js
generated
vendored
Normal file
31
node_modules/sass-embedded/dist/lib/src/compiler-module.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
// Copyright 2025 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.compilerModule = void 0;
|
||||
const p = require("path");
|
||||
const elf_1 = require("./elf");
|
||||
/**
|
||||
* Detect if the given binary is linked with musl libc by checking if
|
||||
* the interpreter basename starts with "ld-musl-"
|
||||
*/
|
||||
function isLinuxMusl(path) {
|
||||
try {
|
||||
const interpreter = (0, elf_1.getElfInterpreter)(path);
|
||||
return p.basename(interpreter).startsWith('ld-musl-');
|
||||
}
|
||||
catch (error) {
|
||||
console.warn(`Warning: Failed to detect linux-musl, fallback to linux-gnu: ${error.message}`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/** The module name for the embedded compiler executable. */
|
||||
exports.compilerModule = (() => {
|
||||
const platform = process.platform === 'linux' && isLinuxMusl(process.execPath)
|
||||
? 'linux-musl'
|
||||
: process.platform;
|
||||
const arch = process.arch;
|
||||
return `sass-embedded-${platform}-${arch}`;
|
||||
})();
|
||||
//# sourceMappingURL=compiler-module.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/compiler-module.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/compiler-module.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"compiler-module.js","sourceRoot":"","sources":["../../../lib/src/compiler-module.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,0BAA0B;AAC1B,+BAAwC;AAExC;;;GAGG;AACH,SAAS,WAAW,CAAC,IAAY;IAC/B,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAA,uBAAiB,EAAC,IAAI,CAAC,CAAC;QAC5C,OAAO,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACxD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CACV,gEAAgE,KAAK,CAAC,OAAO,EAAE,CAChF,CAAC;QACF,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,4DAA4D;AAC/C,QAAA,cAAc,GAAG,CAAC,GAAG,EAAE;IAClC,MAAM,QAAQ,GACZ,OAAO,CAAC,QAAQ,KAAK,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC;QAC3D,CAAC,CAAC,YAAY;QACd,CAAC,CAAE,OAAO,CAAC,QAAmB,CAAC;IAEnC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAE1B,OAAO,iBAAiB,QAAQ,IAAI,IAAI,EAAE,CAAC;AAC7C,CAAC,CAAC,EAAE,CAAC"}
|
||||
49
node_modules/sass-embedded/dist/lib/src/compiler-path.js
generated
vendored
Normal file
49
node_modules/sass-embedded/dist/lib/src/compiler-path.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
// Copyright 2021 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.compilerCommand = void 0;
|
||||
const p = require("path");
|
||||
const compiler_module_1 = require("./compiler-module");
|
||||
/** The full command for the embedded compiler executable. */
|
||||
exports.compilerCommand = (() => {
|
||||
try {
|
||||
return [
|
||||
require.resolve(`${compiler_module_1.compilerModule}/dart-sass/src/dart` +
|
||||
(process.platform === 'win32' ? '.exe' : '')),
|
||||
require.resolve(`${compiler_module_1.compilerModule}/dart-sass/src/sass.snapshot`),
|
||||
];
|
||||
}
|
||||
catch (e) {
|
||||
if (e.code !== 'MODULE_NOT_FOUND') {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
try {
|
||||
return [
|
||||
require.resolve(`${compiler_module_1.compilerModule}/dart-sass/sass` +
|
||||
(process.platform === 'win32' ? '.bat' : '')),
|
||||
];
|
||||
}
|
||||
catch (e) {
|
||||
if (e.code !== 'MODULE_NOT_FOUND') {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
try {
|
||||
return [
|
||||
process.execPath,
|
||||
p.join(p.dirname(require.resolve('sass')), 'sass.js'),
|
||||
];
|
||||
}
|
||||
catch (e) {
|
||||
if (e.code !== 'MODULE_NOT_FOUND') {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
throw new Error("Embedded Dart Sass couldn't find the embedded compiler executable. " +
|
||||
`Please make sure the optional dependency ${compiler_module_1.compilerModule} or sass is ` +
|
||||
'installed in node_modules.');
|
||||
})();
|
||||
//# sourceMappingURL=compiler-path.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/compiler-path.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/compiler-path.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"compiler-path.js","sourceRoot":"","sources":["../../../lib/src/compiler-path.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,0BAA0B;AAC1B,uDAAiD;AAEjD,6DAA6D;AAChD,QAAA,eAAe,GAAG,CAAC,GAAG,EAAE;IACnC,IAAI,CAAC;QACH,OAAO;YACL,OAAO,CAAC,OAAO,CACb,GAAG,gCAAc,qBAAqB;gBACpC,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAC/C;YACD,OAAO,CAAC,OAAO,CAAC,GAAG,gCAAc,8BAA8B,CAAC;SACjE,CAAC;IACJ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;YAClC,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;IAED,IAAI,CAAC;QACH,OAAO;YACL,OAAO,CAAC,OAAO,CACb,GAAG,gCAAc,iBAAiB;gBAChC,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAC/C;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;YAClC,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;IAED,IAAI,CAAC;QACH,OAAO;YACL,OAAO,CAAC,QAAQ;YAChB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC;SACtD,CAAC;IACJ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;YAClC,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;IAED,MAAM,IAAI,KAAK,CACb,qEAAqE;QACnE,4CAA4C,gCAAc,cAAc;QACxE,4BAA4B,CAC/B,CAAC;AACJ,CAAC,CAAC,EAAE,CAAC"}
|
||||
139
node_modules/sass-embedded/dist/lib/src/compiler/async.js
generated
vendored
Normal file
139
node_modules/sass-embedded/dist/lib/src/compiler/async.js
generated
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
"use strict";
|
||||
// Copyright 2024 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AsyncCompiler = void 0;
|
||||
exports.initAsyncCompiler = initAsyncCompiler;
|
||||
const child_process_1 = require("child_process");
|
||||
const rxjs_1 = require("rxjs");
|
||||
const operators_1 = require("rxjs/operators");
|
||||
const path = require("path");
|
||||
const utils_1 = require("./utils");
|
||||
const compiler_path_1 = require("../compiler-path");
|
||||
const deprecations_1 = require("../deprecations");
|
||||
const function_registry_1 = require("../function-registry");
|
||||
const importer_registry_1 = require("../importer-registry");
|
||||
const message_transformer_1 = require("../message-transformer");
|
||||
const packet_transformer_1 = require("../packet-transformer");
|
||||
const utils = require("../utils");
|
||||
/**
|
||||
* Flag allowing the constructor passed by `initAsyncCompiler` so we can
|
||||
* differentiate and throw an error if the `AsyncCompiler` is constructed via
|
||||
* `new AsyncCompiler`.
|
||||
*/
|
||||
const initFlag = Symbol();
|
||||
/** An asynchronous wrapper for the embedded Sass compiler */
|
||||
class AsyncCompiler {
|
||||
/** The underlying process that's being wrapped. */
|
||||
process = (0, child_process_1.spawn)(compiler_path_1.compilerCommand[0], [...compiler_path_1.compilerCommand.slice(1), '--embedded'], {
|
||||
// Use the command's cwd so the compiler survives the removal of the
|
||||
// current working directory.
|
||||
// https://github.com/sass/embedded-host-node/pull/261#discussion_r1438712923
|
||||
cwd: path.dirname(compiler_path_1.compilerCommand[0]),
|
||||
// Node blocks launching .bat and .cmd without a shell due to CVE-2024-27980
|
||||
shell: ['.bat', '.cmd'].includes(path.extname(compiler_path_1.compilerCommand[0]).toLowerCase()),
|
||||
windowsHide: true,
|
||||
});
|
||||
/** The next compilation ID. */
|
||||
compilationId = 1;
|
||||
/** A list of active compilations. */
|
||||
compilations = new Set();
|
||||
/** Whether the underlying compiler has already exited. */
|
||||
disposed = false;
|
||||
/** Reusable message transformer for all compilations. */
|
||||
messageTransformer;
|
||||
/** The child process's exit event. */
|
||||
exit$ = new Promise(resolve => {
|
||||
this.process.on('exit', code => resolve(code));
|
||||
});
|
||||
/** The buffers emitted by the child process's stdout. */
|
||||
stdout$ = new rxjs_1.Observable(observer => {
|
||||
this.process.stdout.on('data', buffer => observer.next(buffer));
|
||||
}).pipe((0, operators_1.takeUntil)(this.exit$));
|
||||
/** The buffers emitted by the child process's stderr. */
|
||||
stderr$ = new rxjs_1.Observable(observer => {
|
||||
this.process.stderr.on('data', buffer => observer.next(buffer));
|
||||
}).pipe((0, operators_1.takeUntil)(this.exit$));
|
||||
/** Writes `buffer` to the child process's stdin. */
|
||||
writeStdin(buffer) {
|
||||
this.process.stdin.write(buffer);
|
||||
}
|
||||
/** Guards against using a disposed compiler. */
|
||||
throwIfDisposed() {
|
||||
if (this.disposed) {
|
||||
throw utils.compilerError('Async compiler has already been disposed.');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Sends a compile request to the child process and returns a Promise that
|
||||
* resolves with the CompileResult. Rejects the promise if there were any
|
||||
* protocol or compilation errors.
|
||||
*/
|
||||
async compileRequestAsync(request, importers, options) {
|
||||
const optionsKey = Symbol();
|
||||
deprecations_1.activeDeprecationOptions.set(optionsKey, options ?? {});
|
||||
try {
|
||||
const functions = new function_registry_1.FunctionRegistry(options?.functions);
|
||||
const dispatcher = (0, utils_1.createDispatcher)(this.compilationId++, this.messageTransformer, {
|
||||
handleImportRequest: request => importers.import(request),
|
||||
handleFileImportRequest: request => importers.fileImport(request),
|
||||
handleCanonicalizeRequest: request => importers.canonicalize(request),
|
||||
handleFunctionCallRequest: request => functions.call(request),
|
||||
});
|
||||
dispatcher.logEvents$.subscribe(event => (0, utils_1.handleLogEvent)(options, event));
|
||||
const compilation = new Promise((resolve, reject) => dispatcher.sendCompileRequest(request, (err, response) => {
|
||||
this.compilations.delete(compilation);
|
||||
// Reset the compilation ID when the compiler goes idle (no active
|
||||
// compilations) to avoid overflowing it.
|
||||
// https://github.com/sass/embedded-host-node/pull/261#discussion_r1429266794
|
||||
if (this.compilations.size === 0)
|
||||
this.compilationId = 1;
|
||||
if (err) {
|
||||
reject(err);
|
||||
}
|
||||
else {
|
||||
resolve(response);
|
||||
}
|
||||
}));
|
||||
this.compilations.add(compilation);
|
||||
return (0, utils_1.handleCompileResponse)(await compilation);
|
||||
}
|
||||
finally {
|
||||
deprecations_1.activeDeprecationOptions.delete(optionsKey);
|
||||
}
|
||||
}
|
||||
/** Initialize resources shared across compilations. */
|
||||
constructor(flag) {
|
||||
if (flag !== initFlag) {
|
||||
throw utils.compilerError('AsyncCompiler can not be directly constructed. ' +
|
||||
'Please use `sass.initAsyncCompiler()` instead.');
|
||||
}
|
||||
this.stderr$.subscribe(data => process.stderr.write(data));
|
||||
const packetTransformer = new packet_transformer_1.PacketTransformer(this.stdout$, buffer => {
|
||||
this.writeStdin(buffer);
|
||||
});
|
||||
this.messageTransformer = new message_transformer_1.MessageTransformer(packetTransformer.outboundProtobufs$, packet => packetTransformer.writeInboundProtobuf(packet));
|
||||
}
|
||||
compileAsync(path, options) {
|
||||
this.throwIfDisposed();
|
||||
const importers = new importer_registry_1.ImporterRegistry(options);
|
||||
return this.compileRequestAsync((0, utils_1.newCompilePathRequest)(path, importers, options), importers, options);
|
||||
}
|
||||
compileStringAsync(source, options) {
|
||||
this.throwIfDisposed();
|
||||
const importers = new importer_registry_1.ImporterRegistry(options);
|
||||
return this.compileRequestAsync((0, utils_1.newCompileStringRequest)(source, importers, options), importers, options);
|
||||
}
|
||||
async dispose() {
|
||||
this.disposed = true;
|
||||
await Promise.all(this.compilations);
|
||||
this.process.stdin.end();
|
||||
await this.exit$;
|
||||
}
|
||||
}
|
||||
exports.AsyncCompiler = AsyncCompiler;
|
||||
async function initAsyncCompiler() {
|
||||
return new AsyncCompiler(initFlag);
|
||||
}
|
||||
//# sourceMappingURL=async.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/compiler/async.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/compiler/async.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"async.js","sourceRoot":"","sources":["../../../../lib/src/compiler/async.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAmMvC,8CAEC;AAnMD,iDAAoC;AACpC,+BAAgC;AAChC,8CAAyC;AAEzC,6BAA6B;AAC7B,mCAQiB;AACjB,oDAAiD;AACjD,kDAAyD;AACzD,4DAAsD;AACtD,4DAAsD;AACtD,gEAA0D;AAC1D,8DAAwD;AACxD,kCAAkC;AAIlC;;;;GAIG;AACH,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC;AAE1B,6DAA6D;AAC7D,MAAa,aAAa;IACxB,mDAAmD;IAClC,OAAO,GAAG,IAAA,qBAAK,EAC9B,+BAAe,CAAC,CAAC,CAAC,EAClB,CAAC,GAAG,+BAAe,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,EAC3C;QACE,oEAAoE;QACpE,6BAA6B;QAC7B,6EAA6E;QAC7E,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,+BAAe,CAAC,CAAC,CAAC,CAAC;QACrC,4EAA4E;QAC5E,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,QAAQ,CAC9B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AAE,CAAC;QACvB,MAAM,SAAS,GAAG,IAAI,oCAAgB,CAAC,OAAO,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC,mBAAmB,CAC7B,IAAA,6BAAqB,EAAC,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,EAC/C,SAAS,EACT,OAAO,CACR,CAAC;IACJ,CAAC;IAED,kBAAkB,CAChB,MAAc,EACd,OAA0C;QAE1C,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,MAAM,SAAS,GAAG,IAAI,oCAAgB,CAAC,OAAO,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC,mBAAmB,CAC7B,IAAA,+BAAuB,EAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EACnD,SAAS,EACT,OAAO,CACR,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACrC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QACzB,MAAM,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;CACF;AA/JD,sCA+JC;AAEM,KAAK,UAAU,iBAAiB;IACrC,OAAO,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC;AACrC,CAAC"}
|
||||
160
node_modules/sass-embedded/dist/lib/src/compiler/sync.js
generated
vendored
Normal file
160
node_modules/sass-embedded/dist/lib/src/compiler/sync.js
generated
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
"use strict";
|
||||
// Copyright 2024 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Compiler = void 0;
|
||||
exports.initCompiler = initCompiler;
|
||||
const rxjs_1 = require("rxjs");
|
||||
const sync_child_process_1 = require("sync-child-process");
|
||||
const path = require("path");
|
||||
const utils_1 = require("./utils");
|
||||
const compiler_path_1 = require("../compiler-path");
|
||||
const deprecations_1 = require("../deprecations");
|
||||
const function_registry_1 = require("../function-registry");
|
||||
const importer_registry_1 = require("../importer-registry");
|
||||
const message_transformer_1 = require("../message-transformer");
|
||||
const packet_transformer_1 = require("../packet-transformer");
|
||||
const utils = require("../utils");
|
||||
/**
|
||||
* Flag allowing the constructor passed by `initCompiler` so we can
|
||||
* differentiate and throw an error if the `Compiler` is constructed via `new
|
||||
* Compiler`.
|
||||
*/
|
||||
const initFlag = Symbol();
|
||||
/** A synchronous wrapper for the embedded Sass compiler */
|
||||
class Compiler {
|
||||
/** The underlying process that's being wrapped. */
|
||||
process = new sync_child_process_1.SyncChildProcess(compiler_path_1.compilerCommand[0], [...compiler_path_1.compilerCommand.slice(1), '--embedded'], {
|
||||
// Use the command's cwd so the compiler survives the removal of the
|
||||
// current working directory.
|
||||
// https://github.com/sass/embedded-host-node/pull/261#discussion_r1438712923
|
||||
cwd: path.dirname(compiler_path_1.compilerCommand[0]),
|
||||
// Node blocks launching .bat and .cmd without a shell due to CVE-2024-27980
|
||||
shell: ['.bat', '.cmd'].includes(path.extname(compiler_path_1.compilerCommand[0]).toLowerCase()),
|
||||
windowsHide: true,
|
||||
});
|
||||
/** The next compilation ID. */
|
||||
compilationId = 1;
|
||||
/** A list of active dispatchers. */
|
||||
dispatchers = new Set();
|
||||
/** The buffers emitted by the child process's stdout. */
|
||||
stdout$ = new rxjs_1.Subject();
|
||||
/** The buffers emitted by the child process's stderr. */
|
||||
stderr$ = new rxjs_1.Subject();
|
||||
/** Whether the underlying compiler has already exited. */
|
||||
disposed = false;
|
||||
/** Reusable message transformer for all compilations. */
|
||||
messageTransformer;
|
||||
/** Writes `buffer` to the child process's stdin. */
|
||||
writeStdin(buffer) {
|
||||
this.process.stdin.write(buffer);
|
||||
}
|
||||
/** Yields the next event from the underlying process. */
|
||||
yield() {
|
||||
const result = this.process.next();
|
||||
if (result.done) {
|
||||
this.disposed = true;
|
||||
return false;
|
||||
}
|
||||
const event = result.value;
|
||||
switch (event.type) {
|
||||
case 'stdout':
|
||||
this.stdout$.next(event.data);
|
||||
return true;
|
||||
case 'stderr':
|
||||
this.stderr$.next(event.data);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/** Blocks until the underlying process exits. */
|
||||
yieldUntilExit() {
|
||||
while (!this.disposed) {
|
||||
this.yield();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Sends a compile request to the child process and returns the CompileResult.
|
||||
* Throws if there were any protocol or compilation errors.
|
||||
*/
|
||||
compileRequestSync(request, importers, options) {
|
||||
const optionsKey = Symbol();
|
||||
deprecations_1.activeDeprecationOptions.set(optionsKey, options ?? {});
|
||||
try {
|
||||
const functions = new function_registry_1.FunctionRegistry(options?.functions);
|
||||
const dispatcher = (0, utils_1.createDispatcher)(this.compilationId++, this.messageTransformer, {
|
||||
handleImportRequest: request => importers.import(request),
|
||||
handleFileImportRequest: request => importers.fileImport(request),
|
||||
handleCanonicalizeRequest: request => importers.canonicalize(request),
|
||||
handleFunctionCallRequest: request => functions.call(request),
|
||||
});
|
||||
this.dispatchers.add(dispatcher);
|
||||
dispatcher.logEvents$.subscribe(event => (0, utils_1.handleLogEvent)(options, event));
|
||||
let error;
|
||||
let response;
|
||||
dispatcher.sendCompileRequest(request, (error_, response_) => {
|
||||
this.dispatchers.delete(dispatcher);
|
||||
// Reset the compilation ID when the compiler goes idle (no active
|
||||
// dispatchers) to avoid overflowing it.
|
||||
// https://github.com/sass/embedded-host-node/pull/261#discussion_r1429266794
|
||||
if (this.dispatchers.size === 0)
|
||||
this.compilationId = 1;
|
||||
if (error_) {
|
||||
error = error_;
|
||||
}
|
||||
else {
|
||||
response = response_;
|
||||
}
|
||||
});
|
||||
for (;;) {
|
||||
if (!this.yield()) {
|
||||
throw utils.compilerError('Embedded compiler exited unexpectedly.');
|
||||
}
|
||||
if (error)
|
||||
throw error;
|
||||
if (response)
|
||||
return (0, utils_1.handleCompileResponse)(response);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
deprecations_1.activeDeprecationOptions.delete(optionsKey);
|
||||
}
|
||||
}
|
||||
/** Guards against using a disposed compiler. */
|
||||
throwIfDisposed() {
|
||||
if (this.disposed) {
|
||||
throw utils.compilerError('Sync compiler has already been disposed.');
|
||||
}
|
||||
}
|
||||
/** Initialize resources shared across compilations. */
|
||||
constructor(flag) {
|
||||
if (flag !== initFlag) {
|
||||
throw utils.compilerError('Compiler can not be directly constructed. ' +
|
||||
'Please use `sass.initAsyncCompiler()` instead.');
|
||||
}
|
||||
this.stderr$.subscribe(data => process.stderr.write(data));
|
||||
const packetTransformer = new packet_transformer_1.PacketTransformer(this.stdout$, buffer => {
|
||||
this.writeStdin(buffer);
|
||||
});
|
||||
this.messageTransformer = new message_transformer_1.MessageTransformer(packetTransformer.outboundProtobufs$, packet => packetTransformer.writeInboundProtobuf(packet));
|
||||
}
|
||||
compile(path, options) {
|
||||
this.throwIfDisposed();
|
||||
const importers = new importer_registry_1.ImporterRegistry(options);
|
||||
return this.compileRequestSync((0, utils_1.newCompilePathRequest)(path, importers, options), importers, options);
|
||||
}
|
||||
compileString(source, options) {
|
||||
this.throwIfDisposed();
|
||||
const importers = new importer_registry_1.ImporterRegistry(options);
|
||||
return this.compileRequestSync((0, utils_1.newCompileStringRequest)(source, importers, options), importers, options);
|
||||
}
|
||||
dispose() {
|
||||
this.process.stdin.end();
|
||||
this.yieldUntilExit();
|
||||
}
|
||||
}
|
||||
exports.Compiler = Compiler;
|
||||
function initCompiler() {
|
||||
return new Compiler(initFlag);
|
||||
}
|
||||
//# sourceMappingURL=sync.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/compiler/sync.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/compiler/sync.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../../lib/src/compiler/sync.ts"],"names":[],"mapp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BAAuB,EAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EACnD,SAAS,EACT,OAAO,CACR,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;CACF;AA5KD,4BA4KC;AAED,SAAgB,YAAY;IAC1B,OAAO,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC"}
|
||||
161
node_modules/sass-embedded/dist/lib/src/compiler/utils.js
generated
vendored
Normal file
161
node_modules/sass-embedded/dist/lib/src/compiler/utils.js
generated
vendored
Normal file
@@ -0,0 +1,161 @@
|
||||
"use strict";
|
||||
// Copyright 2024 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createDispatcher = createDispatcher;
|
||||
exports.newCompilePathRequest = newCompilePathRequest;
|
||||
exports.newCompileStringRequest = newCompileStringRequest;
|
||||
exports.handleLogEvent = handleLogEvent;
|
||||
exports.handleCompileResponse = handleCompileResponse;
|
||||
const p = require("path");
|
||||
const supportsColor = require("supports-color");
|
||||
const protobuf_1 = require("@bufbuild/protobuf");
|
||||
const deprecations_1 = require("../deprecations");
|
||||
const deprotofy_span_1 = require("../deprotofy-span");
|
||||
const dispatcher_1 = require("../dispatcher");
|
||||
const exception_1 = require("../exception");
|
||||
const utils_1 = require("../legacy/utils");
|
||||
const logger_1 = require("../logger");
|
||||
const utils = require("../utils");
|
||||
const proto = require("../vendor/embedded_sass_pb");
|
||||
/**
|
||||
* Creates a dispatcher that dispatches messages from the given `stdout` stream.
|
||||
*/
|
||||
function createDispatcher(compilationId, messageTransformer, handlers) {
|
||||
return new dispatcher_1.Dispatcher(compilationId, messageTransformer.outboundMessages$, message => messageTransformer.writeInboundMessage(message), handlers);
|
||||
}
|
||||
// Creates a compilation request for the given `options` without adding any
|
||||
// input-specific options.
|
||||
function newCompileRequest(importers, options) {
|
||||
const request = (0, protobuf_1.create)(proto.InboundMessage_CompileRequestSchema, {
|
||||
importers: importers.importers,
|
||||
globalFunctions: Object.keys(options?.functions ?? {}),
|
||||
sourceMap: !!options?.sourceMap,
|
||||
sourceMapIncludeSources: !!options?.sourceMapIncludeSources,
|
||||
alertColor: options?.alertColor ?? !!supportsColor.stdout,
|
||||
alertAscii: !!options?.alertAscii,
|
||||
quietDeps: !!options?.quietDeps,
|
||||
verbose: !!options?.verbose,
|
||||
charset: !!(options?.charset ?? true),
|
||||
silent: options?.logger === logger_1.Logger.silent,
|
||||
fatalDeprecation: (0, deprecations_1.getDeprecationIds)(options?.fatalDeprecations ?? []),
|
||||
silenceDeprecation: (0, deprecations_1.getDeprecationIds)(options?.silenceDeprecations ?? []),
|
||||
futureDeprecation: (0, deprecations_1.getDeprecationIds)(options?.futureDeprecations ?? []),
|
||||
});
|
||||
switch (options?.style ?? 'expanded') {
|
||||
case 'expanded':
|
||||
request.style = proto.OutputStyle.EXPANDED;
|
||||
break;
|
||||
case 'compressed':
|
||||
request.style = proto.OutputStyle.COMPRESSED;
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown options.style: "${options?.style}"`);
|
||||
}
|
||||
return request;
|
||||
}
|
||||
// Creates a request for compiling a file.
|
||||
function newCompilePathRequest(path, importers, options) {
|
||||
const absPath = p.resolve(path);
|
||||
const request = newCompileRequest(importers, options);
|
||||
request.input = { case: 'path', value: absPath };
|
||||
return request;
|
||||
}
|
||||
// Creates a request for compiling a string.
|
||||
function newCompileStringRequest(source, importers, options) {
|
||||
const input = (0, protobuf_1.create)(proto.InboundMessage_CompileRequest_StringInputSchema, {
|
||||
source,
|
||||
syntax: utils.protofySyntax(options?.syntax ?? 'scss'),
|
||||
});
|
||||
const url = options?.url?.toString();
|
||||
if (url && url !== utils_1.legacyImporterProtocol) {
|
||||
input.url = url;
|
||||
}
|
||||
if (options && 'importer' in options && options.importer) {
|
||||
input.importer = importers.register(options.importer);
|
||||
}
|
||||
else if (url === utils_1.legacyImporterProtocol) {
|
||||
input.importer = (0, protobuf_1.create)(proto.InboundMessage_CompileRequest_ImporterSchema, {
|
||||
importer: { case: 'path', value: p.resolve('.') },
|
||||
});
|
||||
}
|
||||
else {
|
||||
// When importer is not set on the host, the compiler will set a
|
||||
// FileSystemImporter if `url` is set to a file: url or a NoOpImporter.
|
||||
}
|
||||
const request = newCompileRequest(importers, options);
|
||||
request.input = { case: 'string', value: input };
|
||||
return request;
|
||||
}
|
||||
/** Type guard to check that `id` is a valid deprecation ID. */
|
||||
function validDeprecationId(id) {
|
||||
return !!id && id in deprecations_1.deprecations;
|
||||
}
|
||||
/** Handles a log event according to `options`. */
|
||||
function handleLogEvent(options, event) {
|
||||
let span = event.span ? (0, deprotofy_span_1.deprotofySourceSpan)(event.span) : null;
|
||||
if (span && options?.legacy)
|
||||
span = (0, utils_1.removeLegacyImporterFromSpan)(span);
|
||||
let message = event.message;
|
||||
if (options?.legacy)
|
||||
message = (0, utils_1.removeLegacyImporter)(message);
|
||||
let formatted = event.formatted;
|
||||
if (options?.legacy)
|
||||
formatted = (0, utils_1.removeLegacyImporter)(formatted);
|
||||
const deprecationType = validDeprecationId(event.deprecationType)
|
||||
? deprecations_1.deprecations[event.deprecationType]
|
||||
: null;
|
||||
if (event.type === proto.LogEventType.DEBUG) {
|
||||
if (options?.logger?.debug) {
|
||||
options.logger.debug(message, {
|
||||
span: span,
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.error(formatted);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (options?.logger?.warn) {
|
||||
const params = deprecationType
|
||||
? { deprecation: true, deprecationType: deprecationType }
|
||||
: { deprecation: false };
|
||||
if (span)
|
||||
params.span = span;
|
||||
const stack = event.stackTrace;
|
||||
if (stack) {
|
||||
params.stack = options?.legacy ? (0, utils_1.removeLegacyImporter)(stack) : stack;
|
||||
}
|
||||
options.logger.warn(message, params);
|
||||
}
|
||||
else {
|
||||
console.error(formatted);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Converts a `CompileResponse` into a `CompileResult`.
|
||||
*
|
||||
* Throws a `SassException` if the compilation failed.
|
||||
*/
|
||||
function handleCompileResponse(response) {
|
||||
if (response.result.case === 'success') {
|
||||
const success = response.result.value;
|
||||
const result = {
|
||||
css: success.css,
|
||||
loadedUrls: response.loadedUrls.map(url => new URL(url)),
|
||||
};
|
||||
const sourceMap = success.sourceMap;
|
||||
if (sourceMap)
|
||||
result.sourceMap = JSON.parse(sourceMap);
|
||||
return result;
|
||||
}
|
||||
else if (response.result.case === 'failure') {
|
||||
throw new exception_1.Exception(response.result.value);
|
||||
}
|
||||
else {
|
||||
throw utils.compilerError('Compiler sent empty CompileResponse.');
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=utils.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/compiler/utils.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/compiler/utils.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
119
node_modules/sass-embedded/dist/lib/src/deprecations.js
generated
vendored
Normal file
119
node_modules/sass-embedded/dist/lib/src/deprecations.js
generated
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
"use strict";
|
||||
// Copyright 2024 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.activeDeprecationOptions = exports.deprecations = void 0;
|
||||
exports.getDeprecationIds = getDeprecationIds;
|
||||
exports.warnForHostSideDeprecation = warnForHostSideDeprecation;
|
||||
const version_1 = require("./version");
|
||||
var deprecations_1 = require("./vendor/deprecations");
|
||||
Object.defineProperty(exports, "deprecations", { enumerable: true, get: function () { return deprecations_1.deprecations; } });
|
||||
/**
|
||||
* Converts a mixed array of deprecations, IDs, and versions to an array of IDs
|
||||
* that's ready to include in a CompileRequest.
|
||||
*/
|
||||
function getDeprecationIds(arr) {
|
||||
return arr.map(item => {
|
||||
if (item instanceof version_1.Version) {
|
||||
return item.toString();
|
||||
}
|
||||
else if (typeof item === 'string') {
|
||||
return item;
|
||||
}
|
||||
return item.id;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Map between active compilations and the deprecation options they use.
|
||||
*
|
||||
* This is used to determine which options to use when handling host-side
|
||||
* deprecation warnings that aren't explicitly tied to a particular compilation.
|
||||
*/
|
||||
exports.activeDeprecationOptions = new Map();
|
||||
/**
|
||||
* Handles a host-side deprecation warning, either emitting a warning, throwing
|
||||
* an error, or doing nothing depending on the deprecation options used.
|
||||
*
|
||||
* If no specific deprecation options are passed here, then options will be
|
||||
* determined based on the options of the active compilations.
|
||||
*/
|
||||
function warnForHostSideDeprecation(message, deprecation, options) {
|
||||
if (deprecation.status === 'future' &&
|
||||
!isEnabledFuture(deprecation, options)) {
|
||||
return;
|
||||
}
|
||||
const fullMessage = `Deprecation [${deprecation.id}]: ${message}`;
|
||||
if (isFatal(deprecation, options)) {
|
||||
throw Error(fullMessage);
|
||||
}
|
||||
if (!isSilent(deprecation, options)) {
|
||||
console.warn(fullMessage);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Checks whether the given deprecation is included in the given list of silent
|
||||
* deprecations or is silenced by at least one active compilation.
|
||||
*/
|
||||
function isSilent(deprecation, options) {
|
||||
if (!options) {
|
||||
for (const potentialOptions of exports.activeDeprecationOptions.values()) {
|
||||
if (isSilent(deprecation, potentialOptions))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return getDeprecationIds(options.silenceDeprecations ?? []).includes(deprecation.id);
|
||||
}
|
||||
/**
|
||||
* Checks whether the given deprecation is included in the given list of future
|
||||
* deprecations that should be enabled or is enabled in all active compilations.
|
||||
*/
|
||||
function isEnabledFuture(deprecation, options) {
|
||||
if (!options) {
|
||||
for (const potentialOptions of exports.activeDeprecationOptions.values()) {
|
||||
if (!isEnabledFuture(deprecation, potentialOptions))
|
||||
return false;
|
||||
}
|
||||
return exports.activeDeprecationOptions.size > 0;
|
||||
}
|
||||
return getDeprecationIds(options.futureDeprecations ?? []).includes(deprecation.id);
|
||||
}
|
||||
/**
|
||||
* Checks whether the given deprecation is included in the given list of
|
||||
* fatal deprecations or is marked as fatal in all active compilations.
|
||||
*/
|
||||
function isFatal(deprecation, options) {
|
||||
if (!options) {
|
||||
for (const potentialOptions of exports.activeDeprecationOptions.values()) {
|
||||
if (!isFatal(deprecation, potentialOptions))
|
||||
return false;
|
||||
}
|
||||
return exports.activeDeprecationOptions.size > 0;
|
||||
}
|
||||
const versionNumber = deprecation.deprecatedIn === null
|
||||
? null
|
||||
: deprecation.deprecatedIn.major * 1000000 +
|
||||
deprecation.deprecatedIn.minor * 1000 +
|
||||
deprecation.deprecatedIn.patch;
|
||||
for (const fatal of options.fatalDeprecations ?? []) {
|
||||
if (fatal instanceof version_1.Version) {
|
||||
if (versionNumber === null)
|
||||
continue;
|
||||
if (versionNumber <=
|
||||
fatal.major * 1000000 + fatal.minor * 1000 + fatal.patch) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (typeof fatal === 'string') {
|
||||
if (fatal === deprecation.id)
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if (fatal.id === deprecation.id)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//# sourceMappingURL=deprecations.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/deprecations.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/deprecations.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"deprecations.js","sourceRoot":"","sources":["../../../lib/src/deprecations.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAYvC,8CAWC;AA0BD,gEAkBC;AAhED,uCAAkC;AAElC,sDAAmD;AAA3C,4GAAA,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AY,iBAAO,EAAE,CAAC;YAC7B,IAAI,aAAa,KAAK,IAAI;gBAAE,SAAS;YACrC,IACE,aAAa;gBACb,KAAK,CAAC,KAAK,GAAG,OAAO,GAAG,KAAK,CAAC,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC,KAAK,EACxD,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YACrC,IAAI,KAAK,KAAK,WAAW,CAAC,EAAE;gBAAE,OAAO,IAAI,CAAC;QAC5C,CAAC;aAAM,CAAC;YACN,IAAK,KAAqB,CAAC,EAAE,KAAK,WAAW,CAAC,EAAE;gBAAE,OAAO,IAAI,CAAC;QAChE,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
||||
41
node_modules/sass-embedded/dist/lib/src/deprotofy-span.js
generated
vendored
Normal file
41
node_modules/sass-embedded/dist/lib/src/deprotofy-span.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
// Copyright 2021 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.deprotofySourceSpan = deprotofySourceSpan;
|
||||
const url_1 = require("url");
|
||||
const utils_1 = require("./utils");
|
||||
// Creates a SourceSpan from the given protocol `buffer`. Throws if the buffer
|
||||
// has invalid fields.
|
||||
function deprotofySourceSpan(buffer) {
|
||||
const text = buffer.text;
|
||||
if (buffer.start === undefined) {
|
||||
throw (0, utils_1.compilerError)('Expected SourceSpan to have start.');
|
||||
}
|
||||
let end;
|
||||
if (buffer.end === undefined) {
|
||||
if (text !== '') {
|
||||
throw (0, utils_1.compilerError)('Expected SourceSpan text to be empty.');
|
||||
}
|
||||
else {
|
||||
end = buffer.start;
|
||||
}
|
||||
}
|
||||
else {
|
||||
end = buffer.end;
|
||||
if (end.offset < buffer.start.offset) {
|
||||
throw (0, utils_1.compilerError)('Expected SourceSpan end to be after start.');
|
||||
}
|
||||
}
|
||||
const url = buffer.url === '' ? undefined : new url_1.URL(buffer.url);
|
||||
const context = buffer.context === '' ? undefined : buffer.context;
|
||||
return {
|
||||
text,
|
||||
start: buffer.start,
|
||||
end,
|
||||
url,
|
||||
context,
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=deprotofy-span.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/deprotofy-span.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/deprotofy-span.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"deprotofy-span.js","sourceRoot":"","sources":["../../../lib/src/deprotofy-span.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;AAUvC,kDAgCC;AAxCD,6BAAwB;AAIxB,mCAAsC;AAEtC,8EAA8E;AAC9E,sBAAsB;AACtB,SAAgB,mBAAmB,CAAC,MAAwB;IAC1D,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IAEzB,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,IAAA,qBAAa,EAAC,oCAAoC,CAAC,CAAC;IAC5D,CAAC;IAED,IAAI,GAAG,CAAC;IACR,IAAI,MAAM,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;QAC7B,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;YAChB,MAAM,IAAA,qBAAa,EAAC,uCAAuC,CAAC,CAAC;QAC/D,CAAC;aAAM,CAAC;YACN,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC;QACrB,CAAC;IACH,CAAC;SAAM,CAAC;QACN,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QACjB,IAAI,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YACrC,MAAM,IAAA,qBAAa,EAAC,4CAA4C,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAEhE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;IAEnE,OAAO;QACL,IAAI;QACJ,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,GAAG;QACH,GAAG;QACH,OAAO;KACR,CAAC;AACJ,CAAC"}
|
||||
208
node_modules/sass-embedded/dist/lib/src/dispatcher.js
generated
vendored
Normal file
208
node_modules/sass-embedded/dist/lib/src/dispatcher.js
generated
vendored
Normal file
@@ -0,0 +1,208 @@
|
||||
"use strict";
|
||||
// Copyright 2020 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Dispatcher = void 0;
|
||||
const rxjs_1 = require("rxjs");
|
||||
const operators_1 = require("rxjs/operators");
|
||||
const protobuf_1 = require("@bufbuild/protobuf");
|
||||
const proto = require("./vendor/embedded_sass_pb");
|
||||
const request_tracker_1 = require("./request-tracker");
|
||||
const utils_1 = require("./utils");
|
||||
/**
|
||||
* Dispatches requests, responses, and events for a single compilation.
|
||||
*
|
||||
* Accepts callbacks for processing different types of outbound requests. When
|
||||
* an outbound request arrives, this runs the appropriate callback to process
|
||||
* it, and then sends the result inbound. A single callback must be provided for
|
||||
* each outbound request type. The callback does not need to set the response
|
||||
* ID; the dispatcher handles it.
|
||||
*
|
||||
* Consumers can send an inbound request. This returns a promise that will
|
||||
* either resolve with the corresponding outbound response, or error if any
|
||||
* Protocol Errors were encountered. The consumer does not need to set the
|
||||
* request ID; the dispatcher handles it.
|
||||
*
|
||||
* Outbound events are exposed as Observables.
|
||||
*
|
||||
* Errors are not otherwise exposed to the top-level. Instead, they are surfaced
|
||||
* as an Observable that consumers may choose to subscribe to. Subscribers must
|
||||
* perform proper error handling.
|
||||
*/
|
||||
class Dispatcher {
|
||||
compilationId;
|
||||
outboundMessages$;
|
||||
writeInboundMessage;
|
||||
outboundRequestHandlers;
|
||||
// Tracks the IDs of all outbound requests. An inbound response with matching
|
||||
// ID and type will remove the ID.
|
||||
pendingOutboundRequests = new request_tracker_1.RequestTracker();
|
||||
// All outbound messages for this compilation. If we detect any errors while
|
||||
// dispatching messages, this completes.
|
||||
messages$ = new rxjs_1.Subject();
|
||||
// Subject to unsubscribe from all outbound messages to prevent past
|
||||
// dispatchers with compilation IDs reused by future dispatchers from
|
||||
// receiving messages intended for future dispatchers.
|
||||
unsubscribe$ = new rxjs_1.Subject();
|
||||
// If the dispatcher encounters an error, this errors out. It is publicly
|
||||
// exposed as a readonly Observable.
|
||||
errorInternal$ = new rxjs_1.Subject();
|
||||
/**
|
||||
* If the dispatcher encounters an error, this errors out. Upon error, the
|
||||
* dispatcher rejects all promises awaiting an outbound response, and silently
|
||||
* closes all subscriptions to outbound events.
|
||||
*/
|
||||
error$ = this.errorInternal$.pipe();
|
||||
/**
|
||||
* Outbound log events. If an error occurs, the dispatcher closes this
|
||||
* silently.
|
||||
*/
|
||||
logEvents$ = this.messages$.pipe((0, operators_1.filter)(message => message.message.case === 'logEvent'), (0, operators_1.map)(message => message.message.value));
|
||||
constructor(compilationId, outboundMessages$, writeInboundMessage, outboundRequestHandlers) {
|
||||
this.compilationId = compilationId;
|
||||
this.outboundMessages$ = outboundMessages$;
|
||||
this.writeInboundMessage = writeInboundMessage;
|
||||
this.outboundRequestHandlers = outboundRequestHandlers;
|
||||
if (compilationId < 1) {
|
||||
throw Error(`Invalid compilation ID ${compilationId}.`);
|
||||
}
|
||||
this.outboundMessages$
|
||||
.pipe((0, operators_1.filter)(([compilationId]) => compilationId === this.compilationId), (0, operators_1.map)(([, message]) => message), (0, operators_1.mergeMap)(message => {
|
||||
const result = this.handleOutboundMessage(message);
|
||||
return result instanceof Promise
|
||||
? result.then(() => message)
|
||||
: [message];
|
||||
}), (0, operators_1.takeUntil)(this.unsubscribe$))
|
||||
.subscribe({
|
||||
next: message => this.messages$.next(message),
|
||||
error: error => this.throwAndClose(error),
|
||||
complete: () => {
|
||||
this.messages$.complete();
|
||||
this.errorInternal$.complete();
|
||||
},
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Sends a CompileRequest inbound. Passes the corresponding outbound
|
||||
* CompileResponse or an error to `callback` and unsubscribes from all
|
||||
* outbound events.
|
||||
*
|
||||
* This uses an old-style callback argument so that it can work either
|
||||
* synchronously or asynchronously. If the underlying stdout stream emits
|
||||
* events synchronously, `callback` will be called synchronously.
|
||||
*/
|
||||
sendCompileRequest(request, callback) {
|
||||
// Call the callback but unsubscribe first
|
||||
const callback_ = (err, response) => {
|
||||
this.unsubscribe();
|
||||
return callback(err, response);
|
||||
};
|
||||
if (this.messages$.isStopped) {
|
||||
callback_(new Error('Tried writing to closed dispatcher'), undefined);
|
||||
return;
|
||||
}
|
||||
this.messages$
|
||||
.pipe((0, operators_1.filter)(message => message.message.case === 'compileResponse'), (0, operators_1.map)(message => message.message.value))
|
||||
.subscribe({ next: response => callback_(null, response) });
|
||||
this.error$.subscribe({
|
||||
error: error => callback_(error, undefined),
|
||||
});
|
||||
try {
|
||||
this.writeInboundMessage([
|
||||
this.compilationId,
|
||||
(0, protobuf_1.create)(proto.InboundMessageSchema, {
|
||||
message: { value: request, case: 'compileRequest' },
|
||||
}),
|
||||
]);
|
||||
}
|
||||
catch (error) {
|
||||
this.throwAndClose(error);
|
||||
}
|
||||
}
|
||||
// Stop the outbound message subscription.
|
||||
unsubscribe() {
|
||||
this.unsubscribe$.next(undefined);
|
||||
this.unsubscribe$.complete();
|
||||
}
|
||||
// Rejects with `error` all promises awaiting an outbound response, and
|
||||
// silently closes all subscriptions awaiting outbound events.
|
||||
throwAndClose(error) {
|
||||
this.messages$.complete();
|
||||
this.errorInternal$.error(error);
|
||||
this.unsubscribe();
|
||||
}
|
||||
// Keeps track of all outbound messages. If the outbound `message` contains a
|
||||
// request or response, registers it with pendingOutboundRequests. If it
|
||||
// contains a request, runs the appropriate callback to generate an inbound
|
||||
// response, and then sends it inbound.
|
||||
handleOutboundMessage(message) {
|
||||
switch (message.message.case) {
|
||||
case 'logEvent':
|
||||
// Handled separately by `logEvents$`.
|
||||
return undefined;
|
||||
case 'compileResponse':
|
||||
// Handled separately by `sendCompileRequest`.
|
||||
return undefined;
|
||||
case 'importRequest': {
|
||||
const request = message.message.value;
|
||||
const id = request.id;
|
||||
const type = 'importResponse';
|
||||
this.pendingOutboundRequests.add(id, type);
|
||||
return (0, utils_1.thenOr)(this.outboundRequestHandlers.handleImportRequest(request), response => {
|
||||
this.sendInboundMessage(id, { case: type, value: response });
|
||||
});
|
||||
}
|
||||
case 'fileImportRequest': {
|
||||
const request = message.message.value;
|
||||
const id = request.id;
|
||||
const type = 'fileImportResponse';
|
||||
this.pendingOutboundRequests.add(id, type);
|
||||
return (0, utils_1.thenOr)(this.outboundRequestHandlers.handleFileImportRequest(request), response => {
|
||||
this.sendInboundMessage(id, { case: type, value: response });
|
||||
});
|
||||
}
|
||||
case 'canonicalizeRequest': {
|
||||
const request = message.message.value;
|
||||
const id = request.id;
|
||||
const type = 'canonicalizeResponse';
|
||||
this.pendingOutboundRequests.add(id, type);
|
||||
return (0, utils_1.thenOr)(this.outboundRequestHandlers.handleCanonicalizeRequest(request), response => {
|
||||
this.sendInboundMessage(id, { case: type, value: response });
|
||||
});
|
||||
}
|
||||
case 'functionCallRequest': {
|
||||
const request = message.message.value;
|
||||
const id = request.id;
|
||||
const type = 'functionCallResponse';
|
||||
this.pendingOutboundRequests.add(id, type);
|
||||
return (0, utils_1.thenOr)(this.outboundRequestHandlers.handleFunctionCallRequest(request), response => {
|
||||
this.sendInboundMessage(id, { case: type, value: response });
|
||||
});
|
||||
}
|
||||
case 'error':
|
||||
throw (0, utils_1.hostError)(message.message.value.message);
|
||||
default:
|
||||
throw (0, utils_1.compilerError)(`Unknown message type ${message.message.case}`);
|
||||
}
|
||||
}
|
||||
// Sends a message inbound. Keeps track of all pending inbound requests.
|
||||
sendInboundMessage(requestId, message) {
|
||||
message.value.id = requestId;
|
||||
if (message.case === 'importResponse' ||
|
||||
message.case === 'fileImportResponse' ||
|
||||
message.case === 'canonicalizeResponse' ||
|
||||
message.case === 'functionCallResponse') {
|
||||
this.pendingOutboundRequests.resolve(requestId, message.case);
|
||||
}
|
||||
else {
|
||||
throw Error(`Unknown message type ${message.case}`);
|
||||
}
|
||||
this.writeInboundMessage([
|
||||
this.compilationId,
|
||||
(0, protobuf_1.create)(proto.InboundMessageSchema, { message }),
|
||||
]);
|
||||
}
|
||||
}
|
||||
exports.Dispatcher = Dispatcher;
|
||||
//# sourceMappingURL=dispatcher.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/dispatcher.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/dispatcher.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
81
node_modules/sass-embedded/dist/lib/src/elf.js
generated
vendored
Normal file
81
node_modules/sass-embedded/dist/lib/src/elf.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
"use strict";
|
||||
// Copyright 2024 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getElfInterpreter = getElfInterpreter;
|
||||
const fs = require("fs");
|
||||
/** Read a chunk of data from a file descriptor into a new Buffer. */
|
||||
function readFileDescriptor(fd, position, length) {
|
||||
const buffer = Buffer.alloc(length);
|
||||
let offset = 0;
|
||||
while (offset < length) {
|
||||
const bytesRead = fs.readSync(fd, buffer, {
|
||||
offset: offset,
|
||||
position: position + offset,
|
||||
});
|
||||
if (bytesRead === 0) {
|
||||
throw new Error(`failed to read fd ${fd}`);
|
||||
}
|
||||
offset += bytesRead;
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
/** Parse an ELF file and return its interpreter. */
|
||||
function getElfInterpreter(path) {
|
||||
const fd = fs.openSync(path, 'r');
|
||||
try {
|
||||
const elfIdentification = new DataView(readFileDescriptor(fd, 0, 64).buffer);
|
||||
if (elfIdentification.getUint8(0) !== 0x7f ||
|
||||
elfIdentification.getUint8(1) !== 0x45 ||
|
||||
elfIdentification.getUint8(2) !== 0x4c ||
|
||||
elfIdentification.getUint8(3) !== 0x46) {
|
||||
throw new Error(`${path} is not an ELF file.`);
|
||||
}
|
||||
const elfIdentificationClass = elfIdentification.getUint8(4);
|
||||
if (elfIdentificationClass !== 1 && elfIdentificationClass !== 2) {
|
||||
throw new Error(`${path} has an invalid ELF class.`);
|
||||
}
|
||||
const elfClass32 = elfIdentificationClass === 1;
|
||||
const elfIdentificationData = elfIdentification.getUint8(5);
|
||||
if (elfIdentificationData !== 1 && elfIdentificationData !== 2) {
|
||||
throw new Error(`${path} has an invalid endianness.`);
|
||||
}
|
||||
const littleEndian = elfIdentificationData === 1;
|
||||
// Converting BigUint64 to Number because node Buffer length has to be
|
||||
// number type, and we don't expect any elf we check with this method to
|
||||
// be larger than 9007199254740991 bytes.
|
||||
const programHeadersOffset = elfClass32
|
||||
? elfIdentification.getUint32(28, littleEndian)
|
||||
: Number(elfIdentification.getBigUint64(32, littleEndian));
|
||||
const programHeadersEntrySize = elfClass32
|
||||
? elfIdentification.getUint16(42, littleEndian)
|
||||
: elfIdentification.getUint16(54, littleEndian);
|
||||
const programHeadersEntryCount = elfClass32
|
||||
? elfIdentification.getUint16(44, littleEndian)
|
||||
: elfIdentification.getUint16(56, littleEndian);
|
||||
const programHeaders = new DataView(readFileDescriptor(fd, programHeadersOffset, programHeadersEntrySize * programHeadersEntryCount).buffer);
|
||||
for (let i = 0; i < programHeadersEntryCount; i++) {
|
||||
const byteOffset = i * programHeadersEntrySize;
|
||||
const segmentType = programHeaders.getUint32(byteOffset, littleEndian);
|
||||
if (segmentType !== 3)
|
||||
continue; // 3 is PT_INTERP, the interpreter
|
||||
const segmentOffset = elfClass32
|
||||
? programHeaders.getUint32(byteOffset + 4, littleEndian)
|
||||
: Number(programHeaders.getBigUint64(byteOffset + 8, littleEndian));
|
||||
const segmentFileSize = elfClass32
|
||||
? programHeaders.getUint32(byteOffset + 16, littleEndian)
|
||||
: Number(programHeaders.getBigUint64(byteOffset + 32, littleEndian));
|
||||
const buffer = readFileDescriptor(fd, segmentOffset, segmentFileSize);
|
||||
if (buffer[segmentFileSize - 1] !== 0) {
|
||||
throw new Error(`${path} is corrupted.`);
|
||||
}
|
||||
return buffer.toString('utf8', 0, segmentFileSize - 1);
|
||||
}
|
||||
throw new Error(`${path} does not contain an interpreter entry.`);
|
||||
}
|
||||
finally {
|
||||
fs.closeSync(fd);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=elf.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/elf.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/elf.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"elf.js","sourceRoot":"","sources":["../../../lib/src/elf.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;AA2BvC,8CAwEC;AAjGD,yBAAyB;AAEzB,qEAAqE;AACrE,SAAS,kBAAkB,CACzB,EAAU,EACV,QAAgB,EAChB,MAAc;IAEd,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,OAAO,MAAM,GAAG,MAAM,EAAE,CAAC;QACvB,MAAM,SAAS,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE;YACxC,MAAM,EAAE,MAAM;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AAG,CAAC,EAAE,YAAY,CAAC;gBACxD,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,YAAY,CAAC,UAAU,GAAG,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC;YACtE,MAAM,eAAe,GAAG,UAAU;gBAChC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,UAAU,GAAG,EAAE,EAAE,YAAY,CAAC;gBACzD,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,YAAY,CAAC,UAAU,GAAG,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC;YAEvE,MAAM,MAAM,GAAG,kBAAkB,CAAC,EAAE,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC;YACtE,IAAI,MAAM,CAAC,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;gBACtC,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,gBAAgB,CAAC,CAAC;YAC3C,CAAC;YAED,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,eAAe,GAAG,CAAC,CAAC,CAAC;QACzD,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,yCAAyC,CAAC,CAAC;IACpE,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACnB,CAAC;AACH,CAAC"}
|
||||
23
node_modules/sass-embedded/dist/lib/src/exception.js
generated
vendored
Normal file
23
node_modules/sass-embedded/dist/lib/src/exception.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
// Copyright 2020 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Exception = void 0;
|
||||
const deprotofy_span_1 = require("./deprotofy-span");
|
||||
class Exception extends Error {
|
||||
sassMessage;
|
||||
sassStack;
|
||||
span;
|
||||
constructor(failure) {
|
||||
super(failure.formatted);
|
||||
this.sassMessage = failure.message;
|
||||
this.sassStack = failure.stackTrace;
|
||||
this.span = (0, deprotofy_span_1.deprotofySourceSpan)(failure.span);
|
||||
}
|
||||
toString() {
|
||||
return this.message;
|
||||
}
|
||||
}
|
||||
exports.Exception = Exception;
|
||||
//# sourceMappingURL=exception.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/exception.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/exception.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"exception.js","sourceRoot":"","sources":["../../../lib/src/exception.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAIvC,qDAAqD;AAErD,MAAa,SAAU,SAAQ,KAAK;IACzB,WAAW,CAAS;IACpB,SAAS,CAAS;IAClB,IAAI,CAAa;IAE1B,YAAY,OAA6D;QACvE,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAEzB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;QACnC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC;QACpC,IAAI,CAAC,IAAI,GAAG,IAAA,oCAAmB,EAAC,OAAO,CAAC,IAAK,CAAC,CAAC;IACjD,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AAhBD,8BAgBC"}
|
||||
94
node_modules/sass-embedded/dist/lib/src/function-registry.js
generated
vendored
Normal file
94
node_modules/sass-embedded/dist/lib/src/function-registry.js
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
"use strict";
|
||||
// Copyright 2021 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FunctionRegistry = void 0;
|
||||
const util_1 = require("util");
|
||||
const protobuf_1 = require("@bufbuild/protobuf");
|
||||
const utils = require("./utils");
|
||||
const proto = require("./vendor/embedded_sass_pb");
|
||||
const utils_1 = require("./utils");
|
||||
const protofier_1 = require("./protofier");
|
||||
const value_1 = require("./value");
|
||||
/**
|
||||
* Tracks functions that are defined on the host so that the compiler can
|
||||
* execute them.
|
||||
*/
|
||||
class FunctionRegistry {
|
||||
/**
|
||||
* The globally unique identifier of the current compilation used for tracking
|
||||
* the ownership of CompilerFunction and CompilerMixin objects.
|
||||
*/
|
||||
compileContext = Symbol();
|
||||
functionsByName = new Map();
|
||||
functionsById = new Map();
|
||||
idsByFunction = new Map();
|
||||
/** The next ID to use for a function. */
|
||||
id = 0;
|
||||
constructor(functionsBySignature) {
|
||||
for (const [signature, fn] of Object.entries(functionsBySignature ?? {})) {
|
||||
const openParen = signature.indexOf('(');
|
||||
if (openParen === -1) {
|
||||
throw new Error(`options.functions: "${signature}" is missing "("`);
|
||||
}
|
||||
this.functionsByName.set(signature.substring(0, openParen), fn);
|
||||
}
|
||||
}
|
||||
/** Registers `fn` as a function that can be called using the returned ID. */
|
||||
register(fn) {
|
||||
return utils.putIfAbsent(this.idsByFunction, fn, () => {
|
||||
const id = this.id;
|
||||
this.id += 1;
|
||||
this.functionsById.set(id, fn);
|
||||
return id;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns the function to which `request` refers and returns its response.
|
||||
*/
|
||||
call(request) {
|
||||
const protofier = new protofier_1.Protofier(this);
|
||||
const fn = this.get(request);
|
||||
return (0, utils_1.catchOr)(() => {
|
||||
return (0, utils_1.thenOr)(fn(request.arguments.map(value => protofier.deprotofy(value))), result => {
|
||||
if (!(result instanceof value_1.Value)) {
|
||||
const name = request.identifier.case === 'name'
|
||||
? `"${request.identifier.value}"`
|
||||
: 'anonymous function';
|
||||
throw (`options.functions: ${name} returned non-Value: ` +
|
||||
(0, util_1.inspect)(result));
|
||||
}
|
||||
return (0, protobuf_1.create)(proto.InboundMessage_FunctionCallResponseSchema, {
|
||||
result: { case: 'success', value: protofier.protofy(result) },
|
||||
accessedArgumentLists: protofier.accessedArgumentLists,
|
||||
});
|
||||
});
|
||||
}, error => (0, protobuf_1.create)(proto.InboundMessage_FunctionCallResponseSchema, {
|
||||
result: { case: 'error', value: `${error}` },
|
||||
}));
|
||||
}
|
||||
/** Returns the function to which `request` refers. */
|
||||
get(request) {
|
||||
if (request.identifier.case === 'name') {
|
||||
const fn = this.functionsByName.get(request.identifier.value);
|
||||
if (fn)
|
||||
return fn;
|
||||
throw (0, utils_1.compilerError)('Invalid OutboundMessage_FunctionCallRequest: there is no function ' +
|
||||
`named "${request.identifier.value}"`);
|
||||
}
|
||||
else if (request.identifier.case === 'functionId') {
|
||||
const fn = this.functionsById.get(request.identifier.value);
|
||||
if (fn)
|
||||
return fn;
|
||||
throw (0, utils_1.compilerError)('Invalid OutboundMessage_FunctionCallRequest: there is no function ' +
|
||||
`with ID "${request.identifier.value}"`);
|
||||
}
|
||||
else {
|
||||
throw (0, utils_1.compilerError)('Invalid OutboundMessage_FunctionCallRequest: function identifier is ' +
|
||||
'unset');
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.FunctionRegistry = FunctionRegistry;
|
||||
//# sourceMappingURL=function-registry.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/function-registry.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/function-registry.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"function-registry.js","sourceRoot":"","sources":["../../../lib/src/function-registry.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,+BAA6B;AAC7B,iDAA0C;AAG1C,iCAAiC;AAEjC,mDAAmD;AACnD,mCAAkE;AAClE,2CAAsC;AACtC,mCAA8B;AAE9B;;;GAGG;AACH,MAAa,gBAAgB;IAC3B;;;OAGG;IACa,cAAc,GAAG,MAAM,EAAE,CAAC;IACzB,eAAe,GAAG,IAAI,GAAG,E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AC;QACJ,CAAC;aAAM,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;YACpD,MAAM,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YAC5D,IAAI,EAAE;gBAAE,OAAO,EAAE,CAAC;YAElB,MAAM,IAAA,qBAAa,EACjB,oEAAoE;gBAClE,YAAY,OAAO,CAAC,UAAU,CAAC,KAAK,GAAG,CAC1C,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,IAAA,qBAAa,EACjB,sEAAsE;gBACpE,OAAO,CACV,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAxGD,4CAwGC"}
|
||||
168
node_modules/sass-embedded/dist/lib/src/importer-registry.js
generated
vendored
Normal file
168
node_modules/sass-embedded/dist/lib/src/importer-registry.js
generated
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
"use strict";
|
||||
// Copyright 2021 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ImporterRegistry = exports.NodePackageImporter = void 0;
|
||||
const module_1 = require("module");
|
||||
const p = require("path");
|
||||
const url_1 = require("url");
|
||||
const util_1 = require("util");
|
||||
const protobuf_1 = require("@bufbuild/protobuf");
|
||||
const canonicalize_context_1 = require("./canonicalize-context");
|
||||
const utils = require("./utils");
|
||||
const proto = require("./vendor/embedded_sass_pb");
|
||||
const utils_1 = require("./utils");
|
||||
const entryPointDirectoryKey = Symbol();
|
||||
class NodePackageImporter {
|
||||
[entryPointDirectoryKey];
|
||||
constructor(entryPointDirectory) {
|
||||
entryPointDirectory = entryPointDirectory
|
||||
? p.resolve(entryPointDirectory)
|
||||
: require.main?.filename
|
||||
? p.dirname(require.main.filename)
|
||||
: // TODO: Find a way to use `import.meta.main` once
|
||||
// https://github.com/nodejs/node/issues/49440 is done.
|
||||
process.argv[1]
|
||||
? (0, module_1.createRequire)(process.argv[1]).resolve(process.argv[1])
|
||||
: undefined;
|
||||
if (!entryPointDirectory) {
|
||||
throw new Error('The Node package importer cannot determine an entry point ' +
|
||||
'because `require.main.filename` is not defined. ' +
|
||||
'Please provide an `entryPointDirectory` to the `NodePackageImporter`.');
|
||||
}
|
||||
this[entryPointDirectoryKey] = entryPointDirectory;
|
||||
}
|
||||
}
|
||||
exports.NodePackageImporter = NodePackageImporter;
|
||||
/**
|
||||
* A registry of importers defined in the host that can be invoked by the
|
||||
* compiler.
|
||||
*/
|
||||
class ImporterRegistry {
|
||||
/** Protocol buffer representations of the registered importers. */
|
||||
importers;
|
||||
/** A map from importer IDs to their corresponding importers. */
|
||||
importersById = new Map();
|
||||
/** A map from file importer IDs to their corresponding importers. */
|
||||
fileImportersById = new Map();
|
||||
/** The next ID to use for an importer. */
|
||||
id = 0;
|
||||
constructor(options) {
|
||||
this.importers = (options?.importers ?? [])
|
||||
.map(importer => this.register(importer))
|
||||
.concat((options?.loadPaths ?? []).map(path => (0, protobuf_1.create)(proto.InboundMessage_CompileRequest_ImporterSchema, {
|
||||
importer: { case: 'path', value: p.resolve(path) },
|
||||
})));
|
||||
}
|
||||
/** Converts an importer to a proto without adding it to `this.importers`. */
|
||||
register(importer) {
|
||||
const message = (0, protobuf_1.create)(proto.InboundMessage_CompileRequest_ImporterSchema, {});
|
||||
if (importer instanceof NodePackageImporter) {
|
||||
const importerMessage = (0, protobuf_1.create)(proto.NodePackageImporterSchema, {
|
||||
entryPointDirectory: importer[entryPointDirectoryKey],
|
||||
});
|
||||
message.importer = {
|
||||
case: 'nodePackageImporter',
|
||||
value: importerMessage,
|
||||
};
|
||||
}
|
||||
else if ('canonicalize' in importer) {
|
||||
if ('findFileUrl' in importer) {
|
||||
throw new Error('Importer may not contain both canonicalize() and findFileUrl(): ' +
|
||||
(0, util_1.inspect)(importer));
|
||||
}
|
||||
message.importer = { case: 'importerId', value: this.id };
|
||||
message.nonCanonicalScheme =
|
||||
typeof importer.nonCanonicalScheme === 'string'
|
||||
? [importer.nonCanonicalScheme]
|
||||
: (importer.nonCanonicalScheme ?? []);
|
||||
this.importersById.set(this.id, importer);
|
||||
}
|
||||
else {
|
||||
message.importer = { case: 'fileImporterId', value: this.id };
|
||||
this.fileImportersById.set(this.id, importer);
|
||||
}
|
||||
this.id += 1;
|
||||
return message;
|
||||
}
|
||||
/** Handles a canonicalization request. */
|
||||
canonicalize(request) {
|
||||
const importer = this.importersById.get(request.importerId);
|
||||
if (!importer) {
|
||||
throw utils.compilerError('Unknown CanonicalizeRequest.importer_id');
|
||||
}
|
||||
const canonicalizeContext = new canonicalize_context_1.CanonicalizeContext(request.containingUrl ? new url_1.URL(request.containingUrl) : null, request.fromImport);
|
||||
return (0, utils_1.catchOr)(() => {
|
||||
return (0, utils_1.thenOr)(importer.canonicalize(request.url, canonicalizeContext), url => (0, protobuf_1.create)(proto.InboundMessage_CanonicalizeResponseSchema, {
|
||||
result: url === null
|
||||
? { case: undefined }
|
||||
: { case: 'url', value: url.toString() },
|
||||
containingUrlUnused: !canonicalizeContext.containingUrlAccessed,
|
||||
}));
|
||||
}, error => (0, protobuf_1.create)(proto.InboundMessage_CanonicalizeResponseSchema, {
|
||||
result: { case: 'error', value: `${error}` },
|
||||
}));
|
||||
}
|
||||
/** Handles an import request. */
|
||||
import(request) {
|
||||
const importer = this.importersById.get(request.importerId);
|
||||
if (!importer) {
|
||||
throw utils.compilerError('Unknown ImportRequest.importer_id');
|
||||
}
|
||||
return (0, utils_1.catchOr)(() => {
|
||||
return (0, utils_1.thenOr)(importer.load(new url_1.URL(request.url)), result => {
|
||||
if (!result)
|
||||
return (0, protobuf_1.create)(proto.InboundMessage_ImportResponseSchema, {});
|
||||
if (typeof result.contents !== 'string') {
|
||||
throw Error(`Invalid argument (contents): must be a string but was: ${result.contents.constructor.name}`);
|
||||
}
|
||||
if (result.sourceMapUrl && !result.sourceMapUrl.protocol) {
|
||||
throw Error('Invalid argument (sourceMapUrl): must be absolute but was: ' +
|
||||
result.sourceMapUrl);
|
||||
}
|
||||
return (0, protobuf_1.create)(proto.InboundMessage_ImportResponseSchema, {
|
||||
result: {
|
||||
case: 'success',
|
||||
value: {
|
||||
contents: result.contents,
|
||||
syntax: utils.protofySyntax(result.syntax),
|
||||
sourceMapUrl: result.sourceMapUrl?.toString() ?? '',
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
}, error => (0, protobuf_1.create)(proto.InboundMessage_ImportResponseSchema, {
|
||||
result: { case: 'error', value: `${error}` },
|
||||
}));
|
||||
}
|
||||
/** Handles a file import request. */
|
||||
fileImport(request) {
|
||||
const importer = this.fileImportersById.get(request.importerId);
|
||||
if (!importer) {
|
||||
throw utils.compilerError('Unknown FileImportRequest.importer_id');
|
||||
}
|
||||
const canonicalizeContext = new canonicalize_context_1.CanonicalizeContext(request.containingUrl ? new url_1.URL(request.containingUrl) : null, request.fromImport);
|
||||
return (0, utils_1.catchOr)(() => {
|
||||
return (0, utils_1.thenOr)(importer.findFileUrl(request.url, canonicalizeContext), url => {
|
||||
if (!url) {
|
||||
return (0, protobuf_1.create)(proto.InboundMessage_FileImportResponseSchema, {
|
||||
containingUrlUnused: !canonicalizeContext.containingUrlAccessed,
|
||||
});
|
||||
}
|
||||
if (url.protocol !== 'file:') {
|
||||
throw (`FileImporter ${(0, util_1.inspect)(importer)} returned non-file: URL ` +
|
||||
+`"${url}" for URL "${request.url}".`);
|
||||
}
|
||||
return (0, protobuf_1.create)(proto.InboundMessage_FileImportResponseSchema, {
|
||||
result: { case: 'fileUrl', value: url.toString() },
|
||||
containingUrlUnused: !canonicalizeContext.containingUrlAccessed,
|
||||
});
|
||||
});
|
||||
}, error => (0, protobuf_1.create)(proto.InboundMessage_FileImportResponseSchema, {
|
||||
result: { case: 'error', value: `${error}` },
|
||||
}));
|
||||
}
|
||||
}
|
||||
exports.ImporterRegistry = ImporterRegistry;
|
||||
//# sourceMappingURL=importer-registry.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/importer-registry.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/importer-registry.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
263
node_modules/sass-embedded/dist/lib/src/legacy/importer.js
generated
vendored
Normal file
263
node_modules/sass-embedded/dist/lib/src/legacy/importer.js
generated
vendored
Normal file
@@ -0,0 +1,263 @@
|
||||
"use strict";
|
||||
// Copyright 2022 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LegacyImporterWrapper = exports.metaNamespace = exports.legacyImporterFileProtocol = exports.endOfLoadProtocol = void 0;
|
||||
const assert_1 = require("assert");
|
||||
const fs = require("fs");
|
||||
const p = require("path");
|
||||
const util = require("util");
|
||||
const resolve_path_1 = require("./resolve-path");
|
||||
const utils_1 = require("../utils");
|
||||
const utils_2 = require("./utils");
|
||||
/**
|
||||
* A special URL protocol we use to signal when a stylesheet has finished
|
||||
* loading. This allows us to determine which stylesheet is "current" when
|
||||
* resolving a new load, which in turn allows us to pass in an accurate `prev`
|
||||
* parameter to the legacy callback.
|
||||
*/
|
||||
exports.endOfLoadProtocol = 'sass-embedded-legacy-load-done:';
|
||||
/**
|
||||
* The `file:` URL protocol with [legacyImporterProtocolPrefix] at the beginning.
|
||||
*/
|
||||
exports.legacyImporterFileProtocol = 'legacy-importer-file:';
|
||||
/**
|
||||
* A random namespace for `sass:meta`, so we can use `meta.load-css()` at the end
|
||||
* of the file to signal that a load has finished without polluting a namespace
|
||||
* a user might actually use.
|
||||
*/
|
||||
exports.metaNamespace = `---${Math.random().toString(36).substring(2)}`;
|
||||
// A count of `endOfLoadProtocol` imports that have been generated. Each one
|
||||
// must be a different URL to ensure that the importer results aren't cached.
|
||||
let endOfLoadCount = 0;
|
||||
/**
|
||||
* A wrapper around a `LegacyImporter` callback that exposes it as a new-API
|
||||
* `Importer`.
|
||||
*/
|
||||
class LegacyImporterWrapper {
|
||||
self;
|
||||
callbacks;
|
||||
loadPaths;
|
||||
sync;
|
||||
// A stack of previous URLs passed to `this.callbacks`.
|
||||
prev = [];
|
||||
// The `contents` field returned by the last successful invocation of
|
||||
// `this.callbacks`, if it returned one.
|
||||
lastContents;
|
||||
constructor(self, callbacks, loadPaths, initialPrev, sync) {
|
||||
this.self = self;
|
||||
this.callbacks = callbacks;
|
||||
this.loadPaths = loadPaths;
|
||||
this.sync = sync;
|
||||
const path = initialPrev !== 'stdin';
|
||||
this.prev.push({ url: path ? p.resolve(initialPrev) : 'stdin', path });
|
||||
}
|
||||
canonicalize(url, options) {
|
||||
if (url.startsWith(exports.endOfLoadProtocol))
|
||||
return new URL(url);
|
||||
// Emulate a base importer instead of using a real base importer,
|
||||
// because we want to mark containingUrl as used, which is impossible
|
||||
// in a real base importer.
|
||||
if (options.containingUrl !== null) {
|
||||
try {
|
||||
const absoluteUrl = new URL(url, options.containingUrl).toString();
|
||||
const resolved = this.canonicalize(absoluteUrl, {
|
||||
fromImport: options.fromImport,
|
||||
containingUrl: null,
|
||||
});
|
||||
if (resolved !== null)
|
||||
return resolved;
|
||||
}
|
||||
catch (error) {
|
||||
if (error instanceof TypeError &&
|
||||
(0, utils_1.isErrnoException)(error) &&
|
||||
error.code === 'ERR_INVALID_URL') {
|
||||
// ignore
|
||||
}
|
||||
else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (url.startsWith(utils_2.legacyImporterProtocolPrefix) ||
|
||||
url.startsWith(utils_2.legacyImporterProtocol)) {
|
||||
// A load starts with `legacyImporterProtocolPrefix` if and only if it's a
|
||||
// relative load for the current importer rather than an absolute load.
|
||||
// For the most part, we want to ignore these, but for `file:` URLs
|
||||
// specifically we want to resolve them on the filesystem to ensure
|
||||
// locality.
|
||||
const urlWithoutPrefix = url.substring(utils_2.legacyImporterProtocolPrefix.length);
|
||||
if (urlWithoutPrefix.startsWith('file:')) {
|
||||
let resolved = null;
|
||||
try {
|
||||
const path = (0, utils_1.fileUrlToPathCrossPlatform)(urlWithoutPrefix);
|
||||
resolved = (0, resolve_path_1.resolvePath)(path, options.fromImport);
|
||||
}
|
||||
catch (error) {
|
||||
if (error instanceof TypeError &&
|
||||
(0, utils_1.isErrnoException)(error) &&
|
||||
(error.code === 'ERR_INVALID_URL' ||
|
||||
error.code === 'ERR_INVALID_FILE_URL_PATH')) {
|
||||
// It's possible for `url` to represent an invalid path for the
|
||||
// current platform. For example, `@import "/foo/bar/baz"` will
|
||||
// resolve to `file:///foo/bar/baz` which is an invalid URL on
|
||||
// Windows. In that case, we treat it as though the file doesn't
|
||||
// exist so that the user's custom importer can still handle the
|
||||
// URL.
|
||||
}
|
||||
else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
if (resolved !== null) {
|
||||
this.prev.push({ url: resolved, path: true });
|
||||
return (0, utils_2.pathToLegacyFileUrl)(resolved);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
const prev = this.prev[this.prev.length - 1];
|
||||
return (0, utils_1.thenOr)((0, utils_1.thenOr)(this.invokeCallbacks(url, prev.url, options), result => {
|
||||
if (result instanceof Error)
|
||||
throw result;
|
||||
if (result === null)
|
||||
return null;
|
||||
if (typeof result !== 'object') {
|
||||
throw ('Expected importer to return an object, got ' +
|
||||
`${util.inspect(result)}.`);
|
||||
}
|
||||
if ('contents' in result || !('file' in result)) {
|
||||
this.lastContents = result.contents ?? '';
|
||||
if ('file' in result) {
|
||||
return new URL(utils_2.legacyImporterProtocol +
|
||||
encodeURI(result.file));
|
||||
}
|
||||
else if (/^[A-Za-z+.-]+:/.test(url)) {
|
||||
return new URL(`${utils_2.legacyImporterProtocolPrefix}${url}`);
|
||||
}
|
||||
else {
|
||||
return new URL(utils_2.legacyImporterProtocol + encodeURI(url));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (p.isAbsolute(result.file)) {
|
||||
const resolved = (0, resolve_path_1.resolvePath)(result.file, options.fromImport);
|
||||
return resolved ? (0, utils_2.pathToLegacyFileUrl)(resolved) : null;
|
||||
}
|
||||
const prefixes = [...this.loadPaths, '.'];
|
||||
if (prev.path)
|
||||
prefixes.unshift(p.dirname(prev.url));
|
||||
for (const prefix of prefixes) {
|
||||
const resolved = (0, resolve_path_1.resolvePath)(p.join(prefix, result.file), options.fromImport);
|
||||
if (resolved !== null)
|
||||
return (0, utils_2.pathToLegacyFileUrl)(resolved);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}), result => {
|
||||
if (result !== null) {
|
||||
const path = result.protocol === exports.legacyImporterFileProtocol;
|
||||
this.prev.push({
|
||||
url: path ? (0, utils_2.legacyFileUrlToPath)(result) : url,
|
||||
path,
|
||||
});
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
for (const loadPath of this.loadPaths) {
|
||||
const resolved = (0, resolve_path_1.resolvePath)(p.join(loadPath, url), options.fromImport);
|
||||
if (resolved !== null)
|
||||
return (0, utils_2.pathToLegacyFileUrl)(resolved);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
load(canonicalUrl) {
|
||||
if (canonicalUrl.protocol === exports.endOfLoadProtocol) {
|
||||
this.prev.pop();
|
||||
return {
|
||||
contents: '',
|
||||
syntax: 'scss',
|
||||
sourceMapUrl: new URL(exports.endOfLoadProtocol),
|
||||
};
|
||||
}
|
||||
if (canonicalUrl.protocol === exports.legacyImporterFileProtocol) {
|
||||
const syntax = canonicalUrl.pathname.endsWith('.sass')
|
||||
? 'indented'
|
||||
: canonicalUrl.pathname.endsWith('.css')
|
||||
? 'css'
|
||||
: 'scss';
|
||||
let contents = this.lastContents ??
|
||||
fs.readFileSync((0, utils_2.legacyFileUrlToPath)(canonicalUrl), 'utf-8');
|
||||
this.lastContents = undefined;
|
||||
if (syntax === 'css') {
|
||||
this.prev.pop();
|
||||
}
|
||||
else {
|
||||
contents = this.wrapContents(contents, syntax);
|
||||
}
|
||||
return { contents, syntax, sourceMapUrl: canonicalUrl };
|
||||
}
|
||||
const lastContents = this.lastContents;
|
||||
assert_1.strict.notEqual(lastContents, undefined);
|
||||
this.lastContents = undefined;
|
||||
return {
|
||||
contents: this.wrapContents(lastContents, 'scss'),
|
||||
syntax: 'scss',
|
||||
sourceMapUrl: canonicalUrl,
|
||||
};
|
||||
}
|
||||
// Invokes each callback in `this.callbacks` until one returns a non-null
|
||||
// `LegacyImporterResult`, then returns that result. Returns `null` if all
|
||||
// callbacks return `null`.
|
||||
invokeCallbacks(url, prev, { fromImport }) {
|
||||
(0, assert_1.strict)(this.callbacks.length > 0);
|
||||
const self = { ...this.self, fromImport };
|
||||
self.options = { ...self.options, context: self };
|
||||
const invokeNthCallback = (n) => (0, utils_1.thenOr)(this.invokeCallback(this.callbacks[n], self, url, prev), result => {
|
||||
if (result === null) {
|
||||
if (n === this.callbacks.length - 1)
|
||||
return null;
|
||||
return invokeNthCallback(n + 1);
|
||||
}
|
||||
if ('contents' in result &&
|
||||
result.contents &&
|
||||
typeof result.contents !== 'string') {
|
||||
throw new Error(`Invalid argument (contents): must be a string but was: ${result.contents.constructor.name}`);
|
||||
}
|
||||
return result;
|
||||
});
|
||||
return invokeNthCallback(0);
|
||||
}
|
||||
// Invokes `callback` and converts its return value into a `PromiseOr`.
|
||||
invokeCallback(callback, self, url, prev) {
|
||||
if (this.sync) {
|
||||
return callback.call(self, url, prev);
|
||||
}
|
||||
return new Promise(resolve => {
|
||||
// The cast here is necesary to work around microsoft/TypeScript#33815.
|
||||
const syncResult = callback.call(self, url, prev, resolve);
|
||||
if (syncResult !== undefined)
|
||||
resolve(syncResult);
|
||||
});
|
||||
}
|
||||
// Modifies {@link contents} to ensure that we know when a load has completed
|
||||
// so we can pass the correct `prev` argument to callbacks.
|
||||
wrapContents(contents, syntax) {
|
||||
const url = `"${exports.endOfLoadProtocol}${endOfLoadCount++}"`;
|
||||
if (syntax === 'scss') {
|
||||
return (`@use "sass:meta" as ${exports.metaNamespace};` +
|
||||
contents +
|
||||
`\n;@include ${exports.metaNamespace}.load-css(${url});`);
|
||||
}
|
||||
else {
|
||||
return (`@use "sass:meta" as ${exports.metaNamespace}\n` +
|
||||
contents +
|
||||
`\n@include ${exports.metaNamespace}.load-css(${url})`);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.LegacyImporterWrapper = LegacyImporterWrapper;
|
||||
//# sourceMappingURL=importer.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/legacy/importer.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/legacy/importer.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
296
node_modules/sass-embedded/dist/lib/src/legacy/index.js
generated
vendored
Normal file
296
node_modules/sass-embedded/dist/lib/src/legacy/index.js
generated
vendored
Normal file
@@ -0,0 +1,296 @@
|
||||
"use strict";
|
||||
// Copyright 2021 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.render = render;
|
||||
exports.renderSync = renderSync;
|
||||
const fs = require("fs");
|
||||
const p = require("path");
|
||||
const url_1 = require("url");
|
||||
const importer_registry_1 = require("../importer-registry");
|
||||
const exception_1 = require("../exception");
|
||||
const compile_1 = require("../compile");
|
||||
const deprecations_1 = require("../deprecations");
|
||||
const utils_1 = require("../utils");
|
||||
const wrap_1 = require("./value/wrap");
|
||||
const importer_1 = require("./importer");
|
||||
const utils_2 = require("./utils");
|
||||
function render(options, callback) {
|
||||
try {
|
||||
options = adjustOptions(options);
|
||||
const start = Date.now();
|
||||
(0, deprecations_1.warnForHostSideDeprecation)('The legacy JS API is deprecated and will be removed in ' +
|
||||
'Dart Sass 2.0.0.\n\n' +
|
||||
'More info: https://sass-lang.com/d/legacy-js-api', deprecations_1.deprecations['legacy-js-api'], options);
|
||||
const compileSass = isStringOptions(options)
|
||||
? (0, compile_1.compileStringAsync)(options.data, convertStringOptions(options, false))
|
||||
: (0, compile_1.compileAsync)(options.file, convertOptions(options, false));
|
||||
compileSass.then(result => callback(undefined, newLegacyResult(options, start, result)), error => callback(newLegacyException(error)));
|
||||
}
|
||||
catch (error) {
|
||||
if (error instanceof Error)
|
||||
callback(newLegacyException(error));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
function renderSync(options) {
|
||||
const start = Date.now();
|
||||
try {
|
||||
options = adjustOptions(options);
|
||||
(0, deprecations_1.warnForHostSideDeprecation)('The legacy JS API is deprecated and will be removed in ' +
|
||||
'Dart Sass 2.0.0.\n\n' +
|
||||
'More info: https://sass-lang.com/d/legacy-js-api', deprecations_1.deprecations['legacy-js-api'], options);
|
||||
const result = isStringOptions(options)
|
||||
? (0, compile_1.compileString)(options.data, convertStringOptions(options, true))
|
||||
: (0, compile_1.compile)(options.file, convertOptions(options, true));
|
||||
return newLegacyResult(options, start, result);
|
||||
}
|
||||
catch (error) {
|
||||
throw newLegacyException(error);
|
||||
}
|
||||
}
|
||||
// Does some initial adjustments of `options` to make it easier to pass to the
|
||||
// new API.
|
||||
function adjustOptions(options) {
|
||||
if (!('file' in options && options.file) && !('data' in options)) {
|
||||
throw new Error('Either options.data or options.file must be set.');
|
||||
}
|
||||
// In legacy API, the current working directory is always attempted before
|
||||
// any load path.
|
||||
options.includePaths = [process.cwd(), ...(options.includePaths ?? [])];
|
||||
if (!isStringOptions(options) &&
|
||||
// The `indentedSyntax` option takes precedence over the file extension in the
|
||||
// legacy API, but the new API doesn't have a `syntax` option for a file path.
|
||||
// Instead, we eagerly load the entrypoint into memory and treat it like a
|
||||
// string source.
|
||||
(options.indentedSyntax !==
|
||||
undefined ||
|
||||
options.importer)) {
|
||||
return {
|
||||
...options,
|
||||
data: fs.readFileSync(options.file, 'utf8'),
|
||||
indentedSyntax: !!options
|
||||
.indentedSyntax,
|
||||
};
|
||||
}
|
||||
else {
|
||||
return options;
|
||||
}
|
||||
}
|
||||
// Returns whether `options` is a `LegacyStringOptions`.
|
||||
function isStringOptions(options) {
|
||||
return 'data' in options;
|
||||
}
|
||||
// Converts `LegacyOptions` into new API `Options`.
|
||||
function convertOptions(options, sync) {
|
||||
if ('outputStyle' in options &&
|
||||
options.outputStyle !== 'compressed' &&
|
||||
options.outputStyle !== 'expanded') {
|
||||
throw new Error(`Unknown output style: "${options.outputStyle}"`);
|
||||
}
|
||||
const self = pluginThis(options);
|
||||
const functions = {};
|
||||
for (let [signature, callback] of Object.entries(options.functions ?? {})) {
|
||||
// The legacy API allows signatures without parentheses but the modern API
|
||||
// does not.
|
||||
if (!signature.includes('('))
|
||||
signature += '()';
|
||||
functions[signature.trimLeft()] = (0, wrap_1.wrapFunction)(self, callback, sync);
|
||||
}
|
||||
const importers = options.importer &&
|
||||
(!(options.importer instanceof Array) || options.importer.length > 0)
|
||||
? [
|
||||
new importer_1.LegacyImporterWrapper(self, options.importer instanceof Array
|
||||
? options.importer
|
||||
: [options.importer], options.includePaths ?? [], options.file ?? 'stdin', sync),
|
||||
]
|
||||
: undefined;
|
||||
return {
|
||||
functions,
|
||||
importers: options.pkgImporter instanceof importer_registry_1.NodePackageImporter
|
||||
? [options.pkgImporter, ...(importers ?? [])]
|
||||
: importers,
|
||||
sourceMap: wasSourceMapRequested(options),
|
||||
sourceMapIncludeSources: options.sourceMapContents,
|
||||
loadPaths: importers ? undefined : options.includePaths,
|
||||
style: options.outputStyle,
|
||||
quietDeps: options.quietDeps,
|
||||
verbose: options.verbose,
|
||||
charset: options.charset,
|
||||
logger: options.logger,
|
||||
fatalDeprecations: options.fatalDeprecations,
|
||||
futureDeprecations: options.futureDeprecations,
|
||||
silenceDeprecations: options.silenceDeprecations,
|
||||
legacy: true,
|
||||
};
|
||||
}
|
||||
// Converts `LegacyStringOptions` into new API `StringOptions`.
|
||||
function convertStringOptions(options, sync) {
|
||||
const modernOptions = convertOptions(options, sync);
|
||||
// Use a no-op base importer, because the LegacyImporterWrapper will emulate
|
||||
// the base importer by itself in order to mark containingUrl as accessed.
|
||||
const importer = modernOptions.importers?.some(importer => importer instanceof importer_1.LegacyImporterWrapper)
|
||||
? {
|
||||
canonicalize() {
|
||||
return null;
|
||||
},
|
||||
load() {
|
||||
return null;
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
return {
|
||||
...modernOptions,
|
||||
url: options.file
|
||||
? options.importer
|
||||
? (0, utils_2.pathToLegacyFileUrl)(options.file)
|
||||
: (0, url_1.pathToFileURL)(options.file)
|
||||
: new url_1.URL(utils_2.legacyImporterProtocol),
|
||||
importer,
|
||||
syntax: options.indentedSyntax ? 'indented' : 'scss',
|
||||
};
|
||||
}
|
||||
// Determines whether a sourceMap was requested by the call to `render()`.
|
||||
function wasSourceMapRequested(options) {
|
||||
return (typeof options.sourceMap === 'string' ||
|
||||
(options.sourceMap === true && !!options.outFile));
|
||||
}
|
||||
// Creates the `this` value that's used for callbacks.
|
||||
function pluginThis(options) {
|
||||
const pluginThis = {
|
||||
options: {
|
||||
context: undefined,
|
||||
file: options.file,
|
||||
data: options.data,
|
||||
includePaths: (options.includePaths ?? []).join(p.delimiter),
|
||||
precision: 10,
|
||||
style: 1,
|
||||
indentType: 0,
|
||||
indentWidth: 2,
|
||||
linefeed: '\n',
|
||||
result: {
|
||||
stats: {
|
||||
start: Date.now(),
|
||||
entry: options.file ?? 'data',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
pluginThis.options.context = pluginThis;
|
||||
return pluginThis;
|
||||
}
|
||||
// Transforms the compilation result into an object that mimics the Node Sass
|
||||
// API format.
|
||||
function newLegacyResult(options, start, result) {
|
||||
const end = Date.now();
|
||||
let css = result.css;
|
||||
let sourceMapBytes;
|
||||
if (result.sourceMap) {
|
||||
const sourceMap = result.sourceMap;
|
||||
sourceMap.sourceRoot = options.sourceMapRoot ?? '';
|
||||
const sourceMapPath = typeof options.sourceMap === 'string'
|
||||
? options.sourceMap
|
||||
: options.outFile + '.map';
|
||||
const sourceMapDir = p.dirname(sourceMapPath);
|
||||
if (options.outFile) {
|
||||
sourceMap.file = (0, utils_1.pathToUrlString)(p.relative(sourceMapDir, options.outFile));
|
||||
}
|
||||
else if (options.file) {
|
||||
sourceMap.file = (0, utils_1.pathToUrlString)((0, utils_1.withoutExtension)(options.file) + '.css');
|
||||
}
|
||||
else {
|
||||
sourceMap.file = 'stdin.css';
|
||||
}
|
||||
sourceMap.sources = sourceMap.sources
|
||||
.filter(source => !source.startsWith(importer_1.endOfLoadProtocol))
|
||||
.map(source => {
|
||||
source = (0, utils_2.removeLegacyImporter)(source);
|
||||
if (source.startsWith('file://')) {
|
||||
return (0, utils_1.pathToUrlString)(p.relative(sourceMapDir, (0, utils_1.fileUrlToPathCrossPlatform)(source)));
|
||||
}
|
||||
else if (source.startsWith('data:')) {
|
||||
return 'stdin';
|
||||
}
|
||||
else {
|
||||
return source;
|
||||
}
|
||||
});
|
||||
sourceMapBytes = Buffer.from(JSON.stringify(sourceMap));
|
||||
if (!options.omitSourceMapUrl) {
|
||||
let url;
|
||||
if (options.sourceMapEmbed) {
|
||||
url = `data:application/json;base64,${sourceMapBytes.toString('base64')}`;
|
||||
}
|
||||
else if (options.outFile) {
|
||||
url = (0, utils_1.pathToUrlString)(p.relative(p.dirname(options.outFile), sourceMapPath));
|
||||
}
|
||||
else {
|
||||
url = (0, utils_1.pathToUrlString)(sourceMapPath);
|
||||
}
|
||||
css += `\n\n/*# sourceMappingURL=${url} */`;
|
||||
}
|
||||
}
|
||||
return {
|
||||
css: Buffer.from(css),
|
||||
map: sourceMapBytes,
|
||||
stats: {
|
||||
entry: options.file ?? 'data',
|
||||
start,
|
||||
end,
|
||||
duration: end - start,
|
||||
includedFiles: result.loadedUrls
|
||||
.filter(url => url.protocol !== importer_1.endOfLoadProtocol)
|
||||
.map(url => {
|
||||
if (url.protocol === utils_2.legacyImporterProtocol) {
|
||||
return decodeURI(url.pathname);
|
||||
}
|
||||
const urlString = (0, utils_2.removeLegacyImporter)(url.toString());
|
||||
return urlString.startsWith('file:')
|
||||
? (0, utils_1.fileUrlToPathCrossPlatform)(urlString)
|
||||
: urlString;
|
||||
}),
|
||||
},
|
||||
};
|
||||
}
|
||||
// Decorates an Error with additional fields so that it behaves like a Node Sass
|
||||
// error.
|
||||
function newLegacyException(error) {
|
||||
if (!(error instanceof exception_1.Exception)) {
|
||||
return Object.assign(error, {
|
||||
formatted: error.toString(),
|
||||
status: 3,
|
||||
});
|
||||
}
|
||||
const span = error.span ? (0, utils_2.removeLegacyImporterFromSpan)(error.span) : null;
|
||||
let file;
|
||||
if (!span?.url) {
|
||||
file = 'stdin';
|
||||
}
|
||||
else if (span.url.protocol === 'file:') {
|
||||
// We have to cast to Node's URL type here because the specified type is the
|
||||
// standard URL type which is slightly less featureful. `fileURLToPath()`
|
||||
// does work with standard URL objects in practice, but we know that we
|
||||
// generate Node URLs here regardless.
|
||||
file = (0, utils_1.fileUrlToPathCrossPlatform)(span.url);
|
||||
}
|
||||
else {
|
||||
file = span.url.toString();
|
||||
}
|
||||
const errorString = (0, utils_2.removeLegacyImporter)(error.toString());
|
||||
return Object.assign(new Error(), {
|
||||
status: 1,
|
||||
message: errorString.replace(/^Error: /, ''),
|
||||
formatted: errorString,
|
||||
toString: () => errorString,
|
||||
stack: error.stack ? (0, utils_2.removeLegacyImporter)(error.stack) : undefined,
|
||||
line: (0, utils_1.isNullOrUndefined)(error.span?.start.line)
|
||||
? undefined
|
||||
: error.span.start.line + 1,
|
||||
column: (0, utils_1.isNullOrUndefined)(error.span?.start.column)
|
||||
? undefined
|
||||
: error.span.start.column + 1,
|
||||
file,
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/legacy/index.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/legacy/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
100
node_modules/sass-embedded/dist/lib/src/legacy/resolve-path.js
generated
vendored
Normal file
100
node_modules/sass-embedded/dist/lib/src/legacy/resolve-path.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
"use strict";
|
||||
// Copyright 2022 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.resolvePath = resolvePath;
|
||||
const fs = require("fs");
|
||||
const p = require("path");
|
||||
/**
|
||||
* Resolves a path using the same logic as the filesystem importer.
|
||||
*
|
||||
* This tries to fill in extensions and partial prefixes and check for a
|
||||
* directory default. If no file can be found, it returns `null`.
|
||||
*/
|
||||
function resolvePath(path, fromImport) {
|
||||
const extension = p.extname(path);
|
||||
if (extension === '.sass' || extension === '.scss' || extension === '.css') {
|
||||
return ((fromImport
|
||||
? exactlyOne(tryPath(`${withoutExtension(path)}.import${extension}`))
|
||||
: null) ?? exactlyOne(tryPath(path)));
|
||||
}
|
||||
return ((fromImport ? exactlyOne(tryPathWithExtensions(`${path}.import`)) : null) ??
|
||||
exactlyOne(tryPathWithExtensions(path)) ??
|
||||
tryPathAsDirectory(path, fromImport));
|
||||
}
|
||||
// Like `tryPath`, but checks `.sass`, `.scss`, and `.css` extensions.
|
||||
function tryPathWithExtensions(path) {
|
||||
const result = [...tryPath(path + '.sass'), ...tryPath(path + '.scss')];
|
||||
return result.length > 0 ? result : tryPath(path + '.css');
|
||||
}
|
||||
// Returns the `path` and/or the partial with the same name, if either or both
|
||||
// exists. If neither exists, returns an empty list.
|
||||
function tryPath(path) {
|
||||
const partial = p.join(p.dirname(path), `_${p.basename(path)}`);
|
||||
const result = [];
|
||||
if (fileExists(partial))
|
||||
result.push(partial);
|
||||
if (fileExists(path))
|
||||
result.push(path);
|
||||
return result;
|
||||
}
|
||||
// Returns the resolved index file for `path` if `path` is a directory and the
|
||||
// index file exists. Otherwise, returns `null`.
|
||||
function tryPathAsDirectory(path, fromImport) {
|
||||
if (!dirExists(path))
|
||||
return null;
|
||||
return ((fromImport
|
||||
? exactlyOne(tryPathWithExtensions(p.join(path, 'index.import')))
|
||||
: null) ?? exactlyOne(tryPathWithExtensions(p.join(path, 'index'))));
|
||||
}
|
||||
// If `paths` contains exactly one path, returns that path. If it contains no
|
||||
// paths, returns `null`. If it contains more than one, throws an exception.
|
||||
function exactlyOne(paths) {
|
||||
if (paths.length === 0)
|
||||
return null;
|
||||
if (paths.length === 1)
|
||||
return paths[0];
|
||||
throw new Error("It's not clear which file to import. Found:\n" +
|
||||
paths.map(path => ' ' + path).join('\n'));
|
||||
}
|
||||
// Returns whether or not a file (not a directory) exists at `path`.
|
||||
function fileExists(path) {
|
||||
// `existsSync()` is faster than `statSync()`, but it doesn't clarify whether
|
||||
// the entity in question is a file or a directory. Since false negatives are
|
||||
// much more common than false positives, it works out in our favor to check
|
||||
// this first.
|
||||
if (!fs.existsSync(path))
|
||||
return false;
|
||||
try {
|
||||
return fs.statSync(path).isFile();
|
||||
}
|
||||
catch (error) {
|
||||
if (error.code === 'ENOENT')
|
||||
return false;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
// Returns whether or not a directory (not a file) exists at `path`.
|
||||
function dirExists(path) {
|
||||
// `existsSync()` is faster than `statSync()`, but it doesn't clarify whether
|
||||
// the entity in question is a file or a directory. Since false negatives are
|
||||
// much more common than false positives, it works out in our favor to check
|
||||
// this first.
|
||||
if (!fs.existsSync(path))
|
||||
return false;
|
||||
try {
|
||||
return fs.statSync(path).isDirectory();
|
||||
}
|
||||
catch (error) {
|
||||
if (error.code === 'ENOENT')
|
||||
return false;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
// Returns `path` without its file extension.
|
||||
function withoutExtension(path) {
|
||||
const extension = p.extname(path);
|
||||
return path.substring(0, path.length - extension.length);
|
||||
}
|
||||
//# sourceMappingURL=resolve-path.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/legacy/resolve-path.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/legacy/resolve-path.js.map
generated
vendored
Normal file
@@ -0,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;AAED,oEAAoE;AACpE,SAAS,UAAU,CAAC,IAAY;IAC9B,6EAA6E;IAC7E,6EAA6E;IAC7E,4EAA4E;IAC5E,cAAc;IACd,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAEvC,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IACpC,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QACrE,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,oEAAoE;AACpE,SAAS,SAAS,CAAC,IAAY;IAC7B,6EAA6E;IAC7E,6EAA6E;IAC7E,4EAA4E;IAC5E,cAAc;IACd,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAEvC,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IACzC,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QACrE,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,6CAA6C;AAC7C,SAAS,gBAAgB,CAAC,IAAY;IACpC,MAAM,SAAS,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAC3D,CAAC"}
|
||||
58
node_modules/sass-embedded/dist/lib/src/legacy/utils.js
generated
vendored
Normal file
58
node_modules/sass-embedded/dist/lib/src/legacy/utils.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
// Copyright 2023 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.legacyImporterProtocolPrefix = exports.legacyImporterProtocol = void 0;
|
||||
exports.removeLegacyImporter = removeLegacyImporter;
|
||||
exports.removeLegacyImporterFromSpan = removeLegacyImporterFromSpan;
|
||||
exports.pathToLegacyFileUrl = pathToLegacyFileUrl;
|
||||
exports.legacyFileUrlToPath = legacyFileUrlToPath;
|
||||
const assert_1 = require("assert");
|
||||
const url_1 = require("url");
|
||||
const utils_1 = require("../utils");
|
||||
const importer_1 = require("./importer");
|
||||
/**
|
||||
* The URL protocol to use for URLs canonicalized using `LegacyImporterWrapper`.
|
||||
*/
|
||||
exports.legacyImporterProtocol = 'legacy-importer:';
|
||||
/**
|
||||
* The prefix for absolute URLs canonicalized using `LegacyImporterWrapper`.
|
||||
*
|
||||
* This is used to distinguish imports resolved relative to URLs returned by a
|
||||
* legacy importer from manually-specified absolute URLs.
|
||||
*/
|
||||
exports.legacyImporterProtocolPrefix = 'legacy-importer-';
|
||||
// A regular expression that matches legacy importer protocol syntax that
|
||||
// should be removed from human-readable messages.
|
||||
const removeLegacyImporterRegExp = new RegExp(`${exports.legacyImporterProtocol}|${exports.legacyImporterProtocolPrefix}`, 'g');
|
||||
// Returns `string` with all instances of legacy importer syntax removed.
|
||||
function removeLegacyImporter(string) {
|
||||
return string.replace(removeLegacyImporterRegExp, '');
|
||||
}
|
||||
// Returns a copy of [span] with the URL updated to remove legacy importer
|
||||
// syntax.
|
||||
function removeLegacyImporterFromSpan(span) {
|
||||
if (!span.url)
|
||||
return span;
|
||||
return {
|
||||
...span,
|
||||
url: new URL(removeLegacyImporter(span.url.toString()), (0, url_1.pathToFileURL)(process.cwd())),
|
||||
};
|
||||
}
|
||||
// Converts [path] to a `file:` URL and adds the [legacyImporterProtocolPrefix]
|
||||
// to the beginning so we can distinguish it from manually-specified absolute
|
||||
// `file:` URLs.
|
||||
function pathToLegacyFileUrl(path) {
|
||||
return new URL(`${exports.legacyImporterProtocolPrefix}${(0, url_1.pathToFileURL)(path)}`);
|
||||
}
|
||||
// Converts a `file:` URL with [legacyImporterProtocolPrefix] to the filesystem
|
||||
// path which it represents.
|
||||
function legacyFileUrlToPath(url) {
|
||||
assert_1.strict.equal(url.protocol, importer_1.legacyImporterFileProtocol);
|
||||
const originalUrl = url
|
||||
.toString()
|
||||
.substring(exports.legacyImporterProtocolPrefix.length);
|
||||
return (0, utils_1.fileUrlToPathCrossPlatform)(originalUrl);
|
||||
}
|
||||
//# sourceMappingURL=utils.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/legacy/utils.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/legacy/utils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../lib/src/legacy/utils.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AA8BvC,oDAEC;AAID,oEASC;AAKD,kDAEC;AAID,kDAMC;AA5DD,mCAAwC;AACxC,6BAAkC;AAElC,oCAAoD;AAEpD,yCAAsD;AAEtD;;GAEG;AACU,QAAA,sBAAsB,GAAG,kBAAkB,CAAC;AAEzD;;;;;GAKG;AACU,QAAA,4BAA4B,GAAG,kBAAkB,CAAC;AAE/D,yEAAyE;AACzE,kDAAkD;AAClD,MAAM,0BAA0B,GAAG,IAAI,MAAM,CAC3C,GAAG,8BAAsB,IAAI,oCAA4B,EAAE,EAC3D,GAAG,CACJ,CAAC;AAEF,yEAAyE;AACzE,SAAgB,oBAAoB,CAAC,MAAc;IACjD,OAAO,MAAM,CAAC,OAAO,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC;AACxD,CAAC;AAED,0EAA0E;AAC1E,UAAU;AACV,SAAgB,4BAA4B,CAAC,IAAgB;IAC3D,IAAI,CAAC,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IAC3B,OAAO;QACL,GAAG,IAAI;QACP,GAAG,EAAE,IAAI,GAAG,CACV,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,EACzC,IAAA,mBAAa,EAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAC7B;KACF,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,6EAA6E;AAC7E,gBAAgB;AAChB,SAAgB,mBAAmB,CAAC,IAAY;IAC9C,OAAO,IAAI,GAAG,CAAC,GAAG,oCAA4B,GAAG,IAAA,mBAAa,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC1E,CAAC;AAED,+EAA+E;AAC/E,4BAA4B;AAC5B,SAAgB,mBAAmB,CAAC,GAAQ;IAC1C,eAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,qCAA0B,CAAC,CAAC;IACvD,MAAM,WAAW,GAAG,GAAG;SACpB,QAAQ,EAAE;SACV,SAAS,CAAC,oCAA4B,CAAC,MAAM,CAAC,CAAC;IAClD,OAAO,IAAA,kCAA0B,EAAC,WAAW,CAAC,CAAC;AACjD,CAAC"}
|
||||
18
node_modules/sass-embedded/dist/lib/src/legacy/value/base.js
generated
vendored
Normal file
18
node_modules/sass-embedded/dist/lib/src/legacy/value/base.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
// Copyright 2022 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LegacyValueBase = void 0;
|
||||
/**
|
||||
* A base class for legacy value types. A shared base class makes it easier to
|
||||
* detect legacy values and extract their inner value objects.
|
||||
*/
|
||||
class LegacyValueBase {
|
||||
inner;
|
||||
constructor(inner) {
|
||||
this.inner = inner;
|
||||
}
|
||||
}
|
||||
exports.LegacyValueBase = LegacyValueBase;
|
||||
//# sourceMappingURL=base.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/legacy/value/base.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/legacy/value/base.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../../lib/src/legacy/value/base.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAIvC;;;GAGG;AACH,MAAa,eAAe;IACP;IAAnB,YAAmB,KAAQ;QAAR,UAAK,GAAL,KAAK,CAAG;IAAG,CAAC;CAChC;AAFD,0CAEC"}
|
||||
65
node_modules/sass-embedded/dist/lib/src/legacy/value/color.js
generated
vendored
Normal file
65
node_modules/sass-embedded/dist/lib/src/legacy/value/color.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
// Copyright 2022 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LegacyColor = void 0;
|
||||
const utils_1 = require("../../utils");
|
||||
const color_1 = require("../../value/color");
|
||||
const base_1 = require("./base");
|
||||
class LegacyColor extends base_1.LegacyValueBase {
|
||||
constructor(redOrArgb, green, blue, alpha) {
|
||||
if (redOrArgb instanceof color_1.SassColor) {
|
||||
super(redOrArgb);
|
||||
return;
|
||||
}
|
||||
let red;
|
||||
if ((0, utils_1.isNullOrUndefined)(green) || (0, utils_1.isNullOrUndefined)(blue)) {
|
||||
const argb = redOrArgb;
|
||||
alpha = (argb >> 24) / 0xff;
|
||||
red = (argb >> 16) % 0x100;
|
||||
green = (argb >> 8) % 0x100;
|
||||
blue = argb % 0x100;
|
||||
}
|
||||
else {
|
||||
red = redOrArgb;
|
||||
}
|
||||
super(new color_1.SassColor({
|
||||
red: clamp(red, 0, 255),
|
||||
green: clamp(green, 0, 255),
|
||||
blue: clamp(blue, 0, 255),
|
||||
alpha: alpha ? clamp(alpha, 0, 1) : 1,
|
||||
}));
|
||||
}
|
||||
getR() {
|
||||
return this.inner.red;
|
||||
}
|
||||
setR(value) {
|
||||
this.inner = this.inner.change({ red: clamp(value, 0, 255) });
|
||||
}
|
||||
getG() {
|
||||
return this.inner.green;
|
||||
}
|
||||
setG(value) {
|
||||
this.inner = this.inner.change({ green: clamp(value, 0, 255) });
|
||||
}
|
||||
getB() {
|
||||
return this.inner.blue;
|
||||
}
|
||||
setB(value) {
|
||||
this.inner = this.inner.change({ blue: clamp(value, 0, 255) });
|
||||
}
|
||||
getA() {
|
||||
return this.inner.alpha;
|
||||
}
|
||||
setA(value) {
|
||||
this.inner = this.inner.change({ alpha: clamp(value, 0, 1) });
|
||||
}
|
||||
}
|
||||
exports.LegacyColor = LegacyColor;
|
||||
Object.defineProperty(LegacyColor, 'name', { value: 'sass.types.Color' });
|
||||
// Returns `number` clamped to between `min` and `max`.
|
||||
function clamp(num, min, max) {
|
||||
return Math.min(Math.max(num, min), max);
|
||||
}
|
||||
//# sourceMappingURL=color.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/legacy/value/color.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/legacy/value/color.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"color.js","sourceRoot":"","sources":["../../../../../lib/src/legacy/value/color.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,uCAA8C;AAC9C,6CAA4C;AAC5C,iCAAuC;AAEvC,MAAa,WAAY,SAAQ,sBAA0B;IAKzD,YACE,SAA6B,EAC7B,KAAc,EACd,IAAa,EACb,KAAc;QAEd,IAAI,SAAS,YAAY,iBAAS,EAAE,CAAC;YACnC,KAAK,CAAC,SAAS,CAAC,CAAC;YACjB,OAAO;QACT,CAAC;QAED,IAAI,GAAW,CAAC;Q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,CAAC,EAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAC,CAAC,CAAC;IAChE,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;IACzB,CAAC;IAED,IAAI,CAAC,KAAa;QAChB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAC,CAAC,CAAC;IAC/D,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED,IAAI,CAAC,KAAa;QAChB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,EAAC,CAAC,CAAC;IAC9D,CAAC;CACF;AApED,kCAoEC;AAED,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,EAAC,KAAK,EAAE,kBAAkB,EAAC,CAAC,CAAC;AAExE,uDAAuD;AACvD,SAAS,KAAK,CAAC,GAAW,EAAE,GAAW,EAAE,GAAW;IAClD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;AAC3C,CAAC"}
|
||||
23
node_modules/sass-embedded/dist/lib/src/legacy/value/index.js
generated
vendored
Normal file
23
node_modules/sass-embedded/dist/lib/src/legacy/value/index.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
// Copyright 2022 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Error = exports.String = exports.Number = exports.Null = exports.Map = exports.List = exports.Color = exports.Boolean = void 0;
|
||||
const boolean_1 = require("../../value/boolean");
|
||||
const null_1 = require("../../value/null");
|
||||
const color_1 = require("./color");
|
||||
const list_1 = require("./list");
|
||||
const map_1 = require("./map");
|
||||
const number_1 = require("./number");
|
||||
const string_1 = require("./string");
|
||||
exports.Boolean = boolean_1.SassBooleanInternal;
|
||||
exports.Color = color_1.LegacyColor;
|
||||
exports.List = list_1.LegacyList;
|
||||
exports.Map = map_1.LegacyMap;
|
||||
exports.Null = null_1.SassNull;
|
||||
exports.Number = number_1.LegacyNumber;
|
||||
exports.String = string_1.LegacyString;
|
||||
// For the `sass.types.Error` object, we just re-export the native Error class.
|
||||
exports.Error = global.Error;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/legacy/value/index.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/legacy/value/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lib/src/legacy/value/index.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,iDAAwD;AACxD,2CAA0C;AAC1C,mCAAoC;AACpC,iCAAkC;AAClC,+BAAgC;AAChC,qCAAsC;AACtC,qCAAsC;AAEzB,QAAA,OAAO,GAAG,6BAAmB,CAAC;AAC9B,QAAA,KAAK,GAAG,mBAAW,CAAC;AACpB,QAAA,IAAI,GAAG,iBAAU,CAAC;AAClB,QAAA,GAAG,GAAG,eAAS,CAAC;AAChB,QAAA,IAAI,GAAG,eAAQ,CAAC;AAChB,QAAA,MAAM,GAAG,qBAAY,CAAC;AACtB,QAAA,MAAM,GAAG,qBAAY,CAAC;AAEnC,+EAA+E;AAClE,QAAA,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC"}
|
||||
50
node_modules/sass-embedded/dist/lib/src/legacy/value/list.js
generated
vendored
Normal file
50
node_modules/sass-embedded/dist/lib/src/legacy/value/list.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
// Copyright 2022 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LegacyList = void 0;
|
||||
const base_1 = require("./base");
|
||||
const list_1 = require("../../value/list");
|
||||
const null_1 = require("../../value/null");
|
||||
const wrap_1 = require("./wrap");
|
||||
class LegacyList extends base_1.LegacyValueBase {
|
||||
constructor(lengthOrInner, commaSeparator) {
|
||||
if (lengthOrInner instanceof list_1.SassList) {
|
||||
super(lengthOrInner);
|
||||
return;
|
||||
}
|
||||
super(new list_1.SassList(new Array(lengthOrInner).fill(null_1.sassNull), {
|
||||
separator: commaSeparator === false ? ' ' : ',',
|
||||
}));
|
||||
}
|
||||
getValue(index) {
|
||||
const length = this.inner.asList.size;
|
||||
if (index < 0 || index >= length) {
|
||||
throw new Error(`Invalid index ${index}, must be between 0 and ${length}`);
|
||||
}
|
||||
const value = this.inner.get(index);
|
||||
return value ? (0, wrap_1.wrapValue)(value) : undefined;
|
||||
}
|
||||
setValue(index, value) {
|
||||
this.inner = new list_1.SassList(this.inner.asList.set(index, (0, wrap_1.unwrapValue)(value)), {
|
||||
separator: this.inner.separator,
|
||||
brackets: this.inner.hasBrackets,
|
||||
});
|
||||
}
|
||||
getSeparator() {
|
||||
return this.inner.separator === ',';
|
||||
}
|
||||
setSeparator(isComma) {
|
||||
this.inner = new list_1.SassList(this.inner.asList, {
|
||||
separator: isComma ? ',' : ' ',
|
||||
brackets: this.inner.hasBrackets,
|
||||
});
|
||||
}
|
||||
getLength() {
|
||||
return this.inner.asList.size;
|
||||
}
|
||||
}
|
||||
exports.LegacyList = LegacyList;
|
||||
Object.defineProperty(LegacyList, 'name', { value: 'sass.types.List' });
|
||||
//# sourceMappingURL=list.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/legacy/value/list.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/legacy/value/list.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../../lib/src/legacy/value/list.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,iCAAuC;AAEvC,2CAA0C;AAC1C,2CAA0C;AAC1C,iCAA8C;AAE9C,MAAa,UAAW,SAAQ,sBAAyB;IAIvD,YAAY,aAAgC,EAAE,cAAwB;QACpE,IAAI,aAAa,YAAY,eAAQ,EAAE,CAAC;YACtC,KAAK,CAAC,aAAa,CAAC,CAAC;YACrB,OAAO;QACT,CAAC;QAED,KAAK,CACH,IAAI,eAAQ,CAAC,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,eAAQ,CAAC,EAAE;YACpD,SAAS,EAAE,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;SAChD,CAAC,CACH,CAAC;IACJ,CAAC;IAED,QAAQ,CAAC,KAAa;QACpB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;QACtC,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,IAAI,MAAM,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CACb,iBAAiB,KAAK,2BAA2B,MAAM,EAAE,CAC1D,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACpC,OAAO,KAAK,CAAC,CAAC,CAAC,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9C,CAAC;IAED,QAAQ,CAAC,KAAa,EAAE,KAAkB;QACxC,IAAI,CAAC,KAAK,GAAG,IAAI,eAAQ,CACvB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,IAAA,kBAAW,EAAC,KAAK,CAAC,CAAC,EAChD;YACE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS;YAC/B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW;SACjC,CACF,CAAC;IACJ,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,GAAG,CAAC;IACtC,CAAC;IAED,YAAY,CAAC,OAAgB;QAC3B,IAAI,CAAC,KAAK,GAAG,IAAI,eAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;YAC3C,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;YAC9B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW;SACjC,CAAC,CAAC;IACL,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;IAChC,CAAC;CACF;AApDD,gCAoDC;AAED,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,EAAC,KAAK,EAAE,iBAAiB,EAAC,CAAC,CAAC"}
|
||||
74
node_modules/sass-embedded/dist/lib/src/legacy/value/map.js
generated
vendored
Normal file
74
node_modules/sass-embedded/dist/lib/src/legacy/value/map.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
"use strict";
|
||||
// Copyright 2022 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LegacyMap = void 0;
|
||||
const immutable_1 = require("immutable");
|
||||
const base_1 = require("./base");
|
||||
const map_1 = require("../../value/map");
|
||||
const number_1 = require("../../value/number");
|
||||
const null_1 = require("../../value/null");
|
||||
const wrap_1 = require("./wrap");
|
||||
class LegacyMap extends base_1.LegacyValueBase {
|
||||
constructor(lengthOrInner) {
|
||||
if (lengthOrInner instanceof map_1.SassMap) {
|
||||
super(lengthOrInner);
|
||||
return;
|
||||
}
|
||||
super(new map_1.SassMap((0, immutable_1.OrderedMap)(Array.from({ length: lengthOrInner }, (_, i) => [
|
||||
new number_1.SassNumber(i),
|
||||
null_1.sassNull,
|
||||
]))));
|
||||
}
|
||||
getValue(index) {
|
||||
const value = this.inner.contents.valueSeq().get(index);
|
||||
if (index < 0 || !value) {
|
||||
throw new Error(`Invalid index ${index}, must be between 0 and ` +
|
||||
this.inner.contents.size);
|
||||
}
|
||||
return (0, wrap_1.wrapValue)(value);
|
||||
}
|
||||
setValue(index, value) {
|
||||
this.inner = new map_1.SassMap(this.inner.contents.set(this.getUnwrappedKey(index), (0, wrap_1.unwrapValue)(value)));
|
||||
}
|
||||
getKey(index) {
|
||||
return (0, wrap_1.wrapValue)(this.getUnwrappedKey(index));
|
||||
}
|
||||
// Like `getKey()`, but returns the unwrapped non-legacy value.
|
||||
getUnwrappedKey(index) {
|
||||
const key = this.inner.contents.keySeq().get(index);
|
||||
if (index >= 0 && key)
|
||||
return key;
|
||||
throw new Error(`Invalid index ${index}, must be between 0 and ` +
|
||||
this.inner.contents.size);
|
||||
}
|
||||
setKey(index, key) {
|
||||
const oldMap = this.inner.contents;
|
||||
if (index < 0 || index >= oldMap.size) {
|
||||
throw new Error(`Invalid index ${index}, must be between 0 and ${oldMap.size}`);
|
||||
}
|
||||
const newKey = (0, wrap_1.unwrapValue)(key);
|
||||
const newMap = (0, immutable_1.OrderedMap)().asMutable();
|
||||
let i = 0;
|
||||
for (const [oldKey, oldValue] of oldMap.entries()) {
|
||||
if (i === index) {
|
||||
newMap.set(newKey, oldValue);
|
||||
}
|
||||
else {
|
||||
if (newKey.equals(oldKey)) {
|
||||
throw new Error(`${key} is already in the map`);
|
||||
}
|
||||
newMap.set(oldKey, oldValue);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
this.inner = new map_1.SassMap(newMap.asImmutable());
|
||||
}
|
||||
getLength() {
|
||||
return this.inner.contents.size;
|
||||
}
|
||||
}
|
||||
exports.LegacyMap = LegacyMap;
|
||||
Object.defineProperty(LegacyMap, 'name', { value: 'sass.types.Map' });
|
||||
//# sourceMappingURL=map.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/legacy/value/map.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/legacy/value/map.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"map.js","sourceRoot":"","sources":["../../../../../lib/src/legacy/value/map.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,yCAAqC;AAErC,iCAAuC;AAEvC,yCAAwC;AACxC,+CAA8C;AAE9C,2CAA0C;AAC1C,iCAA8C;AAE9C,MAAa,SAAU,SAAQ,sBAAwB;IACrD,YAAY,aAA+B;QACzC,IAAI,aAAa,YAAY,aAAO,EAAE,CAAC;YACrC,KAAK,CAAC,aAAa,CAAC,CAAC;YACrB,OAAO;QACT,CAAC;QAED,KAAK,CACH,IAAI,aAAO,CACT,IAAA,sBAAU,EACR,KAAK,CAAC,IAAI,CAAC,EAAC,MAAM,EAAE,aAAa,EAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5C,IAAI,mBAAU,CAAC,CAAC,CAAC;YACjB,eAAQ;SACT,CAAC,CACH,CACF,CACF,CAAC;IACJ,CAAC;IAED,QAAQ,CAAC,KAAa;QACpB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACxD,IAAI,KAAK,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CACb,iBAAiB,KAAK,0BAA0B;gBAC9C,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAC3B,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CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;YAClD,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC;gBAChB,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAC/B,CAAC;iBAAM,CAAC;gBACN,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;oBAC1B,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,wBAAwB,CAAC,CAAC;gBAClD,CAAC;gBACD,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAC/B,CAAC;YACD,CAAC,EAAE,CAAC;QACN,CAAC;QAED,IAAI,CAAC,KAAK,GAAG,IAAI,aAAO,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;IAClC,CAAC;CACF;AAjFD,8BAiFC;AAED,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,EAAC,KAAK,EAAE,gBAAgB,EAAC,CAAC,CAAC"}
|
||||
60
node_modules/sass-embedded/dist/lib/src/legacy/value/number.js
generated
vendored
Normal file
60
node_modules/sass-embedded/dist/lib/src/legacy/value/number.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
"use strict";
|
||||
// Copyright 2022 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LegacyNumber = void 0;
|
||||
const number_1 = require("../../value/number");
|
||||
const base_1 = require("./base");
|
||||
class LegacyNumber extends base_1.LegacyValueBase {
|
||||
constructor(valueOrInner, unit) {
|
||||
super(valueOrInner instanceof number_1.SassNumber
|
||||
? valueOrInner
|
||||
: parseNumber(valueOrInner, unit));
|
||||
}
|
||||
getValue() {
|
||||
return this.inner.value;
|
||||
}
|
||||
setValue(value) {
|
||||
this.inner = new number_1.SassNumber(value, {
|
||||
numeratorUnits: this.inner.numeratorUnits,
|
||||
denominatorUnits: this.inner.denominatorUnits,
|
||||
});
|
||||
}
|
||||
getUnit() {
|
||||
return (this.inner.numeratorUnits.join('*') +
|
||||
(this.inner.denominatorUnits.size === 0 ? '' : '/') +
|
||||
this.inner.denominatorUnits.join('*'));
|
||||
}
|
||||
setUnit(unit) {
|
||||
this.inner = parseNumber(this.inner.value, unit);
|
||||
}
|
||||
}
|
||||
exports.LegacyNumber = LegacyNumber;
|
||||
Object.defineProperty(LegacyNumber, 'name', { value: 'sass.types.Number' });
|
||||
// Parses a `SassNumber` from `value` and `unit`, using Node Sass's unit
|
||||
// format.
|
||||
function parseNumber(value, unit) {
|
||||
if (!unit)
|
||||
return new number_1.SassNumber(value);
|
||||
if (!unit.includes('*') && !unit.includes('/')) {
|
||||
return new number_1.SassNumber(value, unit);
|
||||
}
|
||||
const invalidUnit = new Error(`Unit ${unit} is invalid`);
|
||||
const operands = unit.split('/');
|
||||
if (operands.length > 2)
|
||||
throw invalidUnit;
|
||||
const numerator = operands[0];
|
||||
const denominator = operands.length === 1 ? null : operands[1];
|
||||
const numeratorUnits = numerator.length === 0 ? [] : numerator.split('*');
|
||||
if (numeratorUnits.some(unit => unit.length === 0))
|
||||
throw invalidUnit;
|
||||
const denominatorUnits = denominator === null ? [] : denominator.split('*');
|
||||
if (denominatorUnits.some(unit => unit.length === 0))
|
||||
throw invalidUnit;
|
||||
return new number_1.SassNumber(value, {
|
||||
numeratorUnits: numeratorUnits,
|
||||
denominatorUnits: denominatorUnits,
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=number.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/legacy/value/number.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/legacy/value/number.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
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AU,CAAC,KAAK,EAAE;QAC3B,cAAc,EAAE,cAAc;QAC9B,gBAAgB,EAAE,gBAAgB;KACnC,CAAC,CAAC;AACL,CAAC"}
|
||||
27
node_modules/sass-embedded/dist/lib/src/legacy/value/string.js
generated
vendored
Normal file
27
node_modules/sass-embedded/dist/lib/src/legacy/value/string.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
// Copyright 2022 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LegacyString = void 0;
|
||||
const string_1 = require("../../value/string");
|
||||
const base_1 = require("./base");
|
||||
class LegacyString extends base_1.LegacyValueBase {
|
||||
constructor(valueOrInner) {
|
||||
if (valueOrInner instanceof string_1.SassString) {
|
||||
super(valueOrInner);
|
||||
}
|
||||
else {
|
||||
super(new string_1.SassString(valueOrInner, { quotes: false }));
|
||||
}
|
||||
}
|
||||
getValue() {
|
||||
return this.inner.text;
|
||||
}
|
||||
setValue(value) {
|
||||
this.inner = new string_1.SassString(value, { quotes: false });
|
||||
}
|
||||
}
|
||||
exports.LegacyString = LegacyString;
|
||||
Object.defineProperty(LegacyString, 'name', { value: 'sass.types.String' });
|
||||
//# sourceMappingURL=string.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/legacy/value/string.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/legacy/value/string.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../../../lib/src/legacy/value/string.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,+CAA8C;AAC9C,iCAAuC;AAEvC,MAAa,YAAa,SAAQ,sBAA2B;IAC3D,YAAY,YAAiC;QAC3C,IAAI,YAAY,YAAY,mBAAU,EAAE,CAAC;YACvC,KAAK,CAAC,YAAY,CAAC,CAAC;QACtB,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,mBAAU,CAAC,YAAY,EAAE,EAAC,MAAM,EAAE,KAAK,EAAC,CAAC,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;IACzB,CAAC;IAED,QAAQ,CAAC,KAAa;QACpB,IAAI,CAAC,KAAK,GAAG,IAAI,mBAAU,CAAC,KAAK,EAAE,EAAC,MAAM,EAAE,KAAK,EAAC,CAAC,CAAC;IACtD,CAAC;CACF;AAhBD,oCAgBC;AAED,MAAM,CAAC,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,EAAC,KAAK,EAAE,mBAAmB,EAAC,CAAC,CAAC"}
|
||||
82
node_modules/sass-embedded/dist/lib/src/legacy/value/wrap.js
generated
vendored
Normal file
82
node_modules/sass-embedded/dist/lib/src/legacy/value/wrap.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
"use strict";
|
||||
// Copyright 2022 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.wrapFunction = wrapFunction;
|
||||
exports.unwrapValue = unwrapValue;
|
||||
exports.wrapValue = wrapValue;
|
||||
const util = require("util");
|
||||
const base_1 = require("./base");
|
||||
const color_1 = require("./color");
|
||||
const list_1 = require("./list");
|
||||
const map_1 = require("./map");
|
||||
const number_1 = require("./number");
|
||||
const string_1 = require("./string");
|
||||
const value_1 = require("../../value");
|
||||
const color_2 = require("../../value/color");
|
||||
const list_2 = require("../../value/list");
|
||||
const map_2 = require("../../value/map");
|
||||
const number_2 = require("../../value/number");
|
||||
const string_2 = require("../../value/string");
|
||||
/**
|
||||
* Converts a `LegacyFunction` into a `CustomFunction` so it can be passed to
|
||||
* the new JS API.
|
||||
*/
|
||||
function wrapFunction(thisArg, callback, sync) {
|
||||
if (sync) {
|
||||
return args => unwrapTypedValue(callback.apply(thisArg, args.map(wrapValue)));
|
||||
}
|
||||
else {
|
||||
return args => new Promise((resolve, reject) => {
|
||||
function done(result) {
|
||||
try {
|
||||
if (result instanceof Error) {
|
||||
reject(result);
|
||||
}
|
||||
else {
|
||||
resolve(unwrapTypedValue(result));
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
}
|
||||
// The cast here is necesary to work around microsoft/TypeScript#33815.
|
||||
const syncResult = callback.apply(thisArg, [...args.map(wrapValue), done]);
|
||||
if (syncResult !== undefined)
|
||||
resolve(unwrapTypedValue(syncResult));
|
||||
});
|
||||
}
|
||||
}
|
||||
// Like `unwrapValue()`, but returns a `types.Value` type.
|
||||
function unwrapTypedValue(value) {
|
||||
return unwrapValue(value);
|
||||
}
|
||||
/** Converts a value returned by a `LegacyFunction` into a `Value`. */
|
||||
function unwrapValue(value) {
|
||||
if (value instanceof Error)
|
||||
throw value;
|
||||
if (value instanceof value_1.Value)
|
||||
return value;
|
||||
if (value instanceof base_1.LegacyValueBase)
|
||||
return value.inner;
|
||||
throw new Error(`Expected legacy Sass value, got ${util.inspect(value)}.`);
|
||||
}
|
||||
/** Converts a `Value` into a `LegacyValue`. */
|
||||
function wrapValue(value) {
|
||||
if (value instanceof color_2.SassColor)
|
||||
return new color_1.LegacyColor(value);
|
||||
if (value instanceof list_2.SassList)
|
||||
return new list_1.LegacyList(value);
|
||||
if (value instanceof map_2.SassMap)
|
||||
return new map_1.LegacyMap(value);
|
||||
if (value instanceof number_2.SassNumber)
|
||||
return new number_1.LegacyNumber(value);
|
||||
if (value instanceof string_2.SassString)
|
||||
return new string_1.LegacyString(value);
|
||||
if (value instanceof value_1.Value)
|
||||
return value;
|
||||
throw new Error(`Expected Sass value, got ${util.inspect(value)}.`);
|
||||
}
|
||||
//# sourceMappingURL=wrap.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/legacy/value/wrap.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/legacy/value/wrap.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"wrap.js","sourceRoot":"","sources":["../../../../../lib/src/legacy/value/wrap.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;AA6BvC,oCAqCC;AAQD,kCAKC;AAGD,8BAQC;AAxFD,6BAA6B;AAE7B,iCAAuC;AACvC,mCAAoC;AACpC,iCAAkC;AAClC,+BAAgC;AAChC,qCAAsC;AACtC,qCAAsC;AAEtC,uCAAkC;AAClC,6CAA4C;AAC5C,2CAA0C;AAC1C,yCAAwC;AACxC,+CAA8C;AAC9C,+CAA8C;AAS9C;;;GAGG;AACH,SAAgB,YAAY,CAC1B,OAAyB,EACzB,QAA8B,EAC9B,IAAuB;IAEvB,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,IAAI,CAAC,EAAE,CACZ,gBAAgB,CACb,QAAmC,CAAC,KAAK,CACxC,OAAO,EACP,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CACpB,CACF,CAAC;IACN,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,CAAC,EAAE,CACZ,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC9B,SAAS,IAAI,CAAC,MAAe;gBAC3B,IAAI,CAAC;oBACH,IAAI,MAAM,YAAY,KAAK,EAAE,CAAC;wBAC5B,MAAM,CAAC,MAAM,CAAC,CAAC;oBACjB,CAAC;yBAAM,CAAC;wBACN,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;oBACpC,CAAC;gBACH,CAAC;gBAAC,OAAO,KAAc,EAAE,CAAC;oBACxB,MAAM,CAAC,KAAK,CAAC,CAAC;gBAChB,CAAC;YACH,CAAC;YAED,uEAAuE;YACvE,MAAM,UAAU,GAAI,QAA4C,CAAC,KAAK,CACpE,OAAO,E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G,CAAC,CAAC;AACtE,CAAC"}
|
||||
10
node_modules/sass-embedded/dist/lib/src/logger.js
generated
vendored
Normal file
10
node_modules/sass-embedded/dist/lib/src/logger.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
// Copyright 2024 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Logger = void 0;
|
||||
exports.Logger = {
|
||||
silent: { warn() { }, debug() { } },
|
||||
};
|
||||
//# sourceMappingURL=logger.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/logger.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/logger.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../lib/src/logger.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAE1B,QAAA,MAAM,GAAG;IACpB,MAAM,EAAE,EAAC,IAAI,KAAI,CAAC,EAAE,KAAK,KAAI,CAAC,EAAC;CAChC,CAAC"}
|
||||
75
node_modules/sass-embedded/dist/lib/src/message-transformer.js
generated
vendored
Normal file
75
node_modules/sass-embedded/dist/lib/src/message-transformer.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
"use strict";
|
||||
// Copyright 2020 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.MessageTransformer = void 0;
|
||||
const rxjs_1 = require("rxjs");
|
||||
const operators_1 = require("rxjs/operators");
|
||||
const protobuf_1 = require("@bufbuild/protobuf");
|
||||
const varint = require("varint");
|
||||
const utils_1 = require("./utils");
|
||||
const embedded_sass_pb_1 = require("./vendor/embedded_sass_pb");
|
||||
/**
|
||||
* Encodes InboundMessages into protocol buffers and decodes protocol buffers
|
||||
* into OutboundMessages.
|
||||
*/
|
||||
class MessageTransformer {
|
||||
outboundProtobufs$;
|
||||
writeInboundProtobuf;
|
||||
// The decoded messages are written to this Subject. It is publicly exposed
|
||||
// as a readonly Observable.
|
||||
outboundMessagesInternal$ = new rxjs_1.Subject();
|
||||
/**
|
||||
* The OutboundMessages, decoded from protocol buffers. If this fails to
|
||||
* decode a message, it will emit an error.
|
||||
*/
|
||||
outboundMessages$ = this.outboundMessagesInternal$.pipe();
|
||||
constructor(outboundProtobufs$, writeInboundProtobuf) {
|
||||
this.outboundProtobufs$ = outboundProtobufs$;
|
||||
this.writeInboundProtobuf = writeInboundProtobuf;
|
||||
this.outboundProtobufs$
|
||||
.pipe((0, operators_1.map)(decode))
|
||||
.subscribe(this.outboundMessagesInternal$);
|
||||
}
|
||||
/**
|
||||
* Converts the inbound `compilationId` and `message` to a protocol buffer.
|
||||
*/
|
||||
writeInboundMessage([compilationId, message]) {
|
||||
const compilationIdLength = varint.encodingLength(compilationId);
|
||||
const encodedMessage = (0, protobuf_1.toBinary)(embedded_sass_pb_1.InboundMessageSchema, message);
|
||||
const buffer = new Uint8Array(compilationIdLength + encodedMessage.length);
|
||||
varint.encode(compilationId, buffer);
|
||||
buffer.set(encodedMessage, compilationIdLength);
|
||||
try {
|
||||
this.writeInboundProtobuf(buffer);
|
||||
}
|
||||
catch (error) {
|
||||
this.outboundMessagesInternal$.error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.MessageTransformer = MessageTransformer;
|
||||
// Decodes a protobuf `buffer` into a compilation ID and an OutboundMessage,
|
||||
// ensuring that all mandatory message fields are populated. Throws if `buffer`
|
||||
// cannot be decoded into a valid message, or if the message itself contains a
|
||||
// Protocol Error.
|
||||
function decode(buffer) {
|
||||
let compilationId;
|
||||
try {
|
||||
compilationId = varint.decode(buffer);
|
||||
}
|
||||
catch (error) {
|
||||
throw (0, utils_1.compilerError)(`Invalid compilation ID varint: ${error}`);
|
||||
}
|
||||
try {
|
||||
return [
|
||||
compilationId,
|
||||
(0, protobuf_1.fromBinary)(embedded_sass_pb_1.OutboundMessageSchema, new Uint8Array(buffer.buffer, varint.decode.bytes)),
|
||||
];
|
||||
}
|
||||
catch (error) {
|
||||
throw (0, utils_1.compilerError)(`Invalid protobuf: ${error}`);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=message-transformer.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/message-transformer.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/message-transformer.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"message-transformer.js","sourceRoot":"","sources":["../../../lib/src/message-transformer.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,+BAAyC;AACzC,8CAAmC;AACnC,iDAAwD;AACxD,iCAAiC;AAEjC,mCAAsC;AACtC,gEAKmC;AAEnC;;;GAGG;AACH,MAAa,kBAAkB;IAcV;IACA;IAdnB,2EAA2E;IAC3E,4BAA4B;IACX,yBAAyB,GAAG,IAAI,cAAO,EAErD,CAAC;IAEJ;;;OAGG;IACM,iBAAiB,GAAG,IAAI,CAAC,yBAAyB,CAAC,IAAI,EAAE,CAAC;IAEnE,YACmB,kBAA0C,EAC1C,oBAAkD;QADlD,uBAAkB,GAAlB,kBAAkB,CAAwB;QAC1C,yBAAoB,GAApB,oBAAoB,CAA8B;QAEnE,IAAI,CAAC,kBAAkB;aACpB,IAAI,CAAC,IAAA,eAAG,EAAC,MAAM,CAAC,CAAC;aACjB,SAAS,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,mBAAmB,CAAC,CAAC,aAAa,EAAE,OAAO,CAG1C;QACC,MAAM,mBAAmB,GAAG,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;QACjE,MAAM,cAAc,GAAG,IAAA,mBAAQ,EAAC,uCAAoB,EAAE,OAAO,CAAC,CAAC;QAC/D,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,mBAAmB,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QAC3E,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QACrC,MAAM,CAAC,GAAG,CAAC,cAAc,EAAE,mBAAmB,CAAC,CAAC;QAEhD,IAAI,CAAC;YACH,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;QACpC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,yBAAyB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;CACF;AAzCD,gDAyCC;AAED,4EAA4E;AAC5E,+EAA+E;AAC/E,8EAA8E;AAC9E,kBAAkB;AAClB,SAAS,MAAM,CAAC,MAAkB;IAChC,IAAI,aAAqB,CAAC;IAC1B,IAAI,CAAC;QACH,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAA,qBAAa,EAAC,kCAAkC,KAAK,EAAE,CAAC,CAAC;IACjE,CAAC;IAED,IAAI,CAAC;QACH,OAAO;YACL,aAAa;YACb,IAAA,qBAAU,EACR,wCAAqB,EACrB,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CACnD;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAA,qBAAa,EAAC,qBAAqB,KAAK,EAAE,CAAC,CAAC;IACpD,CAAC;AACH,CAAC"}
|
||||
6
node_modules/sass-embedded/dist/lib/src/messages.js
generated
vendored
Normal file
6
node_modules/sass-embedded/dist/lib/src/messages.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
// Copyright 2023 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=messages.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/messages.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/messages.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../lib/src/messages.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC"}
|
||||
170
node_modules/sass-embedded/dist/lib/src/packet-transformer.js
generated
vendored
Normal file
170
node_modules/sass-embedded/dist/lib/src/packet-transformer.js
generated
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
"use strict";
|
||||
// Copyright 2020 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.PacketTransformer = void 0;
|
||||
const rxjs_1 = require("rxjs");
|
||||
const operators_1 = require("rxjs/operators");
|
||||
const BufferBuilder = require("buffer-builder");
|
||||
/**
|
||||
* Decodes arbitrarily-chunked buffers, for example
|
||||
* [ 0 1 2 3 4 5 6 7 ... ],
|
||||
* into packets of set length in the form
|
||||
* +---------+------------- ...
|
||||
* | 0 1 2 3 | 4 5 6 7 ...
|
||||
* +---------+------------- ...
|
||||
* | HEADER | PAYLOAD (PROTOBUF)
|
||||
* +---------+------------- ...
|
||||
* and emits the payload of each packet.
|
||||
*
|
||||
* Encodes packets by attaching a header to a protobuf that describes the
|
||||
* protobuf's length.
|
||||
*/
|
||||
class PacketTransformer {
|
||||
outboundBuffers$;
|
||||
writeInboundBuffer;
|
||||
// The packet that is actively being decoded as buffers come in.
|
||||
packet = new Packet();
|
||||
// The decoded protobufs are written to this Subject. It is publicly exposed
|
||||
// as a readonly Observable.
|
||||
outboundProtobufsInternal$ = new rxjs_1.Subject();
|
||||
/**
|
||||
* The fully-decoded, outbound protobufs. If any errors are encountered
|
||||
* during encoding/decoding, this Observable will error out.
|
||||
*/
|
||||
outboundProtobufs$ = this.outboundProtobufsInternal$.pipe();
|
||||
constructor(outboundBuffers$, writeInboundBuffer) {
|
||||
this.outboundBuffers$ = outboundBuffers$;
|
||||
this.writeInboundBuffer = writeInboundBuffer;
|
||||
this.outboundBuffers$
|
||||
.pipe((0, operators_1.mergeMap)(buffer => this.decode(buffer)))
|
||||
.subscribe(this.outboundProtobufsInternal$);
|
||||
}
|
||||
/**
|
||||
* Encodes a packet by pre-fixing `protobuf` with a header that describes its
|
||||
* length.
|
||||
*/
|
||||
writeInboundProtobuf(protobuf) {
|
||||
try {
|
||||
let length = protobuf.length;
|
||||
if (length === 0) {
|
||||
this.writeInboundBuffer(Buffer.alloc(1));
|
||||
return;
|
||||
}
|
||||
// Write the length in varint format, 7 bits at a time from least to most
|
||||
// significant.
|
||||
const header = new BufferBuilder(8);
|
||||
while (length > 0) {
|
||||
// The highest-order bit indicates whether more bytes are necessary to
|
||||
// fully express the number. The lower 7 bits indicate the number's
|
||||
// value.
|
||||
header.appendUInt8((length > 0x7f ? 0x80 : 0) | (length & 0x7f));
|
||||
length >>= 7;
|
||||
}
|
||||
const packet = Buffer.alloc(header.length + protobuf.length);
|
||||
header.copy(packet);
|
||||
packet.set(protobuf, header.length);
|
||||
this.writeInboundBuffer(packet);
|
||||
}
|
||||
catch (error) {
|
||||
this.outboundProtobufsInternal$.error(error);
|
||||
}
|
||||
}
|
||||
// Decodes a buffer, filling up the packet that is actively being decoded.
|
||||
// Returns a list of decoded payloads.
|
||||
decode(buffer) {
|
||||
const payloads = [];
|
||||
let decodedBytes = 0;
|
||||
while (decodedBytes < buffer.length) {
|
||||
decodedBytes += this.packet.write(buffer.slice(decodedBytes));
|
||||
if (this.packet.isComplete && this.packet.payload) {
|
||||
payloads.push(this.packet.payload);
|
||||
this.packet = new Packet();
|
||||
}
|
||||
}
|
||||
return payloads;
|
||||
}
|
||||
}
|
||||
exports.PacketTransformer = PacketTransformer;
|
||||
/** A length-delimited packet comprised of a header and payload. */
|
||||
class Packet {
|
||||
// The number of bits we've consumed so far to fill out `payloadLength`.
|
||||
payloadLengthBits = 0;
|
||||
// The length of the next message, in bytes.
|
||||
//
|
||||
// This is built up from a [varint]. Once it's fully consumed, `payload` is
|
||||
// initialized and this is reset to 0.
|
||||
//
|
||||
// [varint]: https://developers.google.com/protocol-buffers/docs/encoding#varints
|
||||
payloadLength = 0;
|
||||
/**
|
||||
* The packet's payload. Constructed by calls to write().
|
||||
* @see write
|
||||
*/
|
||||
payload;
|
||||
// The offset in [payload] that should be written to next time data arrives.
|
||||
payloadOffset = 0;
|
||||
/** Whether the packet construction is complete. */
|
||||
get isComplete() {
|
||||
return !!(this.payload && this.payloadOffset >= this.payloadLength);
|
||||
}
|
||||
/**
|
||||
* Takes arbitrary binary input and slots it into the header and payload
|
||||
* appropriately. Returns the number of bytes that were written into the
|
||||
* packet. This method can be called repeatedly, incrementally building
|
||||
* up the packet until it is complete.
|
||||
*/
|
||||
write(source) {
|
||||
if (this.isComplete) {
|
||||
throw Error('Cannot write to a completed Packet.');
|
||||
}
|
||||
// The index of the next byte to read from [source]. We have to track this
|
||||
// because the source may contain the length *and* the message.
|
||||
let i = 0;
|
||||
// We can be in one of two states here:
|
||||
//
|
||||
// * [payload] is `null`, in which case we're adding data to [payloadLength]
|
||||
// until we reach a byte with its most significant bit set to 0.
|
||||
//
|
||||
// * [payload] is not `null`, in which case we're waiting for
|
||||
// [payloadOffset] to reach [payloadLength] bytes in it so this packet is
|
||||
// complete.
|
||||
if (!this.payload) {
|
||||
for (;;) {
|
||||
const byte = source[i];
|
||||
// Varints encode data in the 7 lower bits of each byte, which we access
|
||||
// by masking with 0x7f = 0b01111111.
|
||||
this.payloadLength += (byte & 0x7f) << this.payloadLengthBits;
|
||||
this.payloadLengthBits += 7;
|
||||
i++;
|
||||
if (byte <= 0x7f) {
|
||||
// If the byte is lower than 0x7f = 0b01111111, that means its high
|
||||
// bit is unset which and we now know the full message length and can
|
||||
// initialize [this.payload].
|
||||
this.payload = Buffer.alloc(this.payloadLength);
|
||||
break;
|
||||
}
|
||||
else if (i === source.length) {
|
||||
// If we've hit the end of the source chunk, we need to wait for the
|
||||
// next chunk to arrive. Just return the number of bytes we've
|
||||
// consumed so far.
|
||||
return i;
|
||||
}
|
||||
else {
|
||||
// Otherwise, we continue reading bytes from the source data to fill
|
||||
// in [this.payloadLength].
|
||||
}
|
||||
}
|
||||
}
|
||||
// Copy as many bytes as we can from [source] to [payload], making sure not
|
||||
// to try to copy more than the payload can hold (if the source has another
|
||||
// message after the current one) or more than the source has available (if
|
||||
// the current message is split across multiple chunks).
|
||||
const bytesToWrite = Math.min(this.payload.length - this.payloadOffset, source.length - i);
|
||||
this.payload.set(source.subarray(i, i + bytesToWrite), this.payloadOffset);
|
||||
this.payloadOffset += bytesToWrite;
|
||||
return i + bytesToWrite;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=packet-transformer.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/packet-transformer.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/packet-transformer.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"packet-transformer.js","sourceRoot":"","sources":["../../../lib/src/packet-transformer.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,+BAAyC;AACzC,8CAAwC;AACxC,gDAAiD;AAEjD;;;;;;;;;;;;;GAaG;AACH,MAAa,iBAAiB;IAeT;IACA;IAfnB,gEAAgE;IACxD,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;IAE9B,4EAA4E;IAC5E,4BAA4B;IACX,0BAA0B,GAAG,IAAI,cAAO,EAAU,CAAC;IAEpE;;;OAGG;IACM,kBAAkB,GAAG,IAAI,CAAC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AM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAC3E,IAAI,CAAC,aAAa,IAAI,YAAY,CAAC;QAEnC,OAAO,CAAC,GAAG,YAAY,CAAC;IAC1B,CAAC;CACF"}
|
||||
458
node_modules/sass-embedded/dist/lib/src/protofier.js
generated
vendored
Normal file
458
node_modules/sass-embedded/dist/lib/src/protofier.js
generated
vendored
Normal file
@@ -0,0 +1,458 @@
|
||||
"use strict";
|
||||
// Copyright 2021 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Protofier = void 0;
|
||||
const immutable_1 = require("immutable");
|
||||
const protobuf_1 = require("@bufbuild/protobuf");
|
||||
const proto = require("./vendor/embedded_sass_pb");
|
||||
const utils = require("./utils");
|
||||
const argument_list_1 = require("./value/argument-list");
|
||||
const color_1 = require("./value/color");
|
||||
const function_1 = require("./value/function");
|
||||
const list_1 = require("./value/list");
|
||||
const map_1 = require("./value/map");
|
||||
const number_1 = require("./value/number");
|
||||
const string_1 = require("./value/string");
|
||||
const null_1 = require("./value/null");
|
||||
const boolean_1 = require("./value/boolean");
|
||||
const calculations_1 = require("./value/calculations");
|
||||
const mixin_1 = require("./value/mixin");
|
||||
/**
|
||||
* A class that converts [Value] objects into protobufs.
|
||||
*
|
||||
* A given [Protofier] instance is valid only within the scope of a single
|
||||
* custom function call.
|
||||
*/
|
||||
class Protofier {
|
||||
functions;
|
||||
/** All the argument lists returned by `deprotofy()`. */
|
||||
argumentLists = [];
|
||||
/**
|
||||
* Returns IDs of all argument lists passed to `deprotofy()` whose keywords
|
||||
* have been accessed.
|
||||
*/
|
||||
get accessedArgumentLists() {
|
||||
return this.argumentLists
|
||||
.filter(list => list.keywordsAccessed)
|
||||
.map(list => list.id);
|
||||
}
|
||||
constructor(
|
||||
/**
|
||||
* The registry of custom functions that can be invoked by the compiler.
|
||||
* This is used to register first-class functions so that the compiler may
|
||||
* invoke them.
|
||||
*/
|
||||
functions) {
|
||||
this.functions = functions;
|
||||
}
|
||||
/** Converts `value` to its protocol buffer representation. */
|
||||
protofy(value) {
|
||||
const result = (0, protobuf_1.create)(proto.ValueSchema, {});
|
||||
if (value instanceof string_1.SassString) {
|
||||
const string = (0, protobuf_1.create)(proto.Value_StringSchema, {
|
||||
text: value.text,
|
||||
quoted: value.hasQuotes,
|
||||
});
|
||||
result.value = { case: 'string', value: string };
|
||||
}
|
||||
else if (value instanceof number_1.SassNumber) {
|
||||
result.value = { case: 'number', value: this.protofyNumber(value) };
|
||||
}
|
||||
else if (value instanceof color_1.SassColor) {
|
||||
const channels = value.channelsOrNull;
|
||||
const color = (0, protobuf_1.create)(proto.Value_ColorSchema, {
|
||||
channel1: channels.get(0),
|
||||
channel2: channels.get(1),
|
||||
channel3: channels.get(2),
|
||||
alpha: value.isChannelMissing('alpha') ? undefined : value.alpha,
|
||||
space: value.space,
|
||||
});
|
||||
result.value = { case: 'color', value: color };
|
||||
}
|
||||
else if (value instanceof list_1.SassList) {
|
||||
const list = (0, protobuf_1.create)(proto.Value_ListSchema, {
|
||||
separator: this.protofySeparator(value.separator),
|
||||
hasBrackets: value.hasBrackets,
|
||||
contents: value.asList.map(element => this.protofy(element)).toArray(),
|
||||
});
|
||||
result.value = { case: 'list', value: list };
|
||||
}
|
||||
else if (value instanceof argument_list_1.SassArgumentList) {
|
||||
if (value.compileContext === this.functions.compileContext) {
|
||||
const list = (0, protobuf_1.create)(proto.Value_ArgumentListSchema, { id: value.id });
|
||||
result.value = { case: 'argumentList', value: list };
|
||||
}
|
||||
else {
|
||||
const list = (0, protobuf_1.create)(proto.Value_ArgumentListSchema, {
|
||||
separator: this.protofySeparator(value.separator),
|
||||
contents: value.asList
|
||||
.map(element => this.protofy(element))
|
||||
.toArray(),
|
||||
});
|
||||
for (const [key, mapValue] of value.keywordsInternal) {
|
||||
list.keywords[key] = this.protofy(mapValue);
|
||||
}
|
||||
result.value = { case: 'argumentList', value: list };
|
||||
}
|
||||
}
|
||||
else if (value instanceof map_1.SassMap) {
|
||||
const map = (0, protobuf_1.create)(proto.Value_MapSchema, {
|
||||
entries: value.contents.toArray().map(([key, value]) => ({
|
||||
key: this.protofy(key),
|
||||
value: this.protofy(value),
|
||||
})),
|
||||
});
|
||||
result.value = { case: 'map', value: map };
|
||||
}
|
||||
else if (value instanceof function_1.SassFunction) {
|
||||
if (value.id !== undefined) {
|
||||
if (value.compileContext !== this.functions.compileContext) {
|
||||
throw utils.compilerError(`Value ${value} does not belong to this compilation`);
|
||||
}
|
||||
const fn = (0, protobuf_1.create)(proto.Value_CompilerFunctionSchema, value);
|
||||
result.value = { case: 'compilerFunction', value: fn };
|
||||
}
|
||||
else {
|
||||
const fn = (0, protobuf_1.create)(proto.Value_HostFunctionSchema, {
|
||||
id: this.functions.register(value.callback),
|
||||
signature: value.signature,
|
||||
});
|
||||
result.value = { case: 'hostFunction', value: fn };
|
||||
}
|
||||
}
|
||||
else if (value instanceof mixin_1.SassMixin) {
|
||||
if (value.compileContext !== this.functions.compileContext) {
|
||||
throw utils.compilerError(`Value ${value} does not belong to this compilation`);
|
||||
}
|
||||
const mixin = (0, protobuf_1.create)(proto.Value_CompilerMixinSchema, value);
|
||||
result.value = { case: 'compilerMixin', value: mixin };
|
||||
}
|
||||
else if (value instanceof calculations_1.SassCalculation) {
|
||||
result.value = {
|
||||
case: 'calculation',
|
||||
value: this.protofyCalculation(value),
|
||||
};
|
||||
}
|
||||
else if (value === boolean_1.sassTrue) {
|
||||
result.value = { case: 'singleton', value: proto.SingletonValue.TRUE };
|
||||
}
|
||||
else if (value === boolean_1.sassFalse) {
|
||||
result.value = { case: 'singleton', value: proto.SingletonValue.FALSE };
|
||||
}
|
||||
else if (value === null_1.sassNull) {
|
||||
result.value = { case: 'singleton', value: proto.SingletonValue.NULL };
|
||||
}
|
||||
else {
|
||||
throw utils.compilerError(`Unknown Value ${value}`);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/** Converts `number` to its protocol buffer representation. */
|
||||
protofyNumber(number) {
|
||||
return (0, protobuf_1.create)(proto.Value_NumberSchema, {
|
||||
value: number.value,
|
||||
numerators: number.numeratorUnits.toArray(),
|
||||
denominators: number.denominatorUnits.toArray(),
|
||||
});
|
||||
}
|
||||
/** Converts `separator` to its protocol buffer representation. */
|
||||
protofySeparator(separator) {
|
||||
switch (separator) {
|
||||
case ',':
|
||||
return proto.ListSeparator.COMMA;
|
||||
case ' ':
|
||||
return proto.ListSeparator.SPACE;
|
||||
case '/':
|
||||
return proto.ListSeparator.SLASH;
|
||||
case null:
|
||||
return proto.ListSeparator.UNDECIDED;
|
||||
default:
|
||||
throw utils.compilerError(`Unknown ListSeparator ${separator}`);
|
||||
}
|
||||
}
|
||||
/** Converts `calculation` to its protocol buffer representation. */
|
||||
protofyCalculation(calculation) {
|
||||
return (0, protobuf_1.create)(proto.Value_CalculationSchema, {
|
||||
name: calculation.name,
|
||||
arguments: calculation.arguments
|
||||
.map(this.protofyCalculationValue.bind(this))
|
||||
.toArray(),
|
||||
});
|
||||
}
|
||||
/** Converts a CalculationValue that appears within a `SassCalculation` to
|
||||
* its protocol buffer representation. */
|
||||
protofyCalculationValue(value) {
|
||||
const result = (0, protobuf_1.create)(proto.Value_Calculation_CalculationValueSchema, {});
|
||||
if (value instanceof calculations_1.SassCalculation) {
|
||||
result.value = {
|
||||
case: 'calculation',
|
||||
value: this.protofyCalculation(value),
|
||||
};
|
||||
}
|
||||
else if (value instanceof calculations_1.CalculationOperation) {
|
||||
result.value = {
|
||||
case: 'operation',
|
||||
value: (0, protobuf_1.create)(proto.Value_Calculation_CalculationOperationSchema, {
|
||||
operator: this.protofyCalculationOperator(value.operator),
|
||||
left: this.protofyCalculationValue(value.left),
|
||||
right: this.protofyCalculationValue(value.right),
|
||||
}),
|
||||
};
|
||||
}
|
||||
else if (value instanceof calculations_1.CalculationInterpolation) {
|
||||
result.value = { case: 'interpolation', value: value.value };
|
||||
}
|
||||
else if (value instanceof string_1.SassString) {
|
||||
result.value = { case: 'string', value: value.text };
|
||||
}
|
||||
else if (value instanceof number_1.SassNumber) {
|
||||
result.value = { case: 'number', value: this.protofyNumber(value) };
|
||||
}
|
||||
else {
|
||||
throw utils.compilerError(`Unknown CalculationValue ${value}`);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/** Converts `operator` to its protocol buffer representation. */
|
||||
protofyCalculationOperator(operator) {
|
||||
switch (operator) {
|
||||
case '+':
|
||||
return proto.CalculationOperator.PLUS;
|
||||
case '-':
|
||||
return proto.CalculationOperator.MINUS;
|
||||
case '*':
|
||||
return proto.CalculationOperator.TIMES;
|
||||
case '/':
|
||||
return proto.CalculationOperator.DIVIDE;
|
||||
default:
|
||||
throw utils.compilerError(`Unknown CalculationOperator ${operator}`);
|
||||
}
|
||||
}
|
||||
/** Converts `value` to its JS representation. */
|
||||
deprotofy(value) {
|
||||
switch (value.value.case) {
|
||||
case 'string': {
|
||||
const string = value.value.value;
|
||||
return string.text.length === 0
|
||||
? string_1.SassString.empty({ quotes: string.quoted })
|
||||
: new string_1.SassString(string.text, { quotes: string.quoted });
|
||||
}
|
||||
case 'number': {
|
||||
return this.deprotofyNumber(value.value.value);
|
||||
}
|
||||
case 'color': {
|
||||
const color = value.value.value;
|
||||
const channel1 = color.channel1 ?? null;
|
||||
const channel2 = color.channel2 ?? null;
|
||||
const channel3 = color.channel3 ?? null;
|
||||
const alpha = color.alpha ?? null;
|
||||
const space = color.space;
|
||||
switch (color.space.toLowerCase()) {
|
||||
case 'rgb':
|
||||
case 'srgb':
|
||||
case 'srgb-linear':
|
||||
case 'display-p3':
|
||||
case 'a98-rgb':
|
||||
case 'prophoto-rgb':
|
||||
case 'rec2020':
|
||||
return new color_1.SassColor({
|
||||
red: channel1,
|
||||
green: channel2,
|
||||
blue: channel3,
|
||||
alpha,
|
||||
space,
|
||||
});
|
||||
case 'hsl':
|
||||
return new color_1.SassColor({
|
||||
hue: channel1,
|
||||
saturation: channel2,
|
||||
lightness: channel3,
|
||||
alpha,
|
||||
space,
|
||||
});
|
||||
case 'hwb':
|
||||
return new color_1.SassColor({
|
||||
hue: channel1,
|
||||
whiteness: channel2,
|
||||
blackness: channel3,
|
||||
alpha,
|
||||
space,
|
||||
});
|
||||
case 'lab':
|
||||
case 'oklab':
|
||||
return new color_1.SassColor({
|
||||
lightness: channel1,
|
||||
a: channel2,
|
||||
b: channel3,
|
||||
alpha,
|
||||
space,
|
||||
});
|
||||
case 'lch':
|
||||
case 'oklch':
|
||||
return new color_1.SassColor({
|
||||
lightness: channel1,
|
||||
chroma: channel2,
|
||||
hue: channel3,
|
||||
alpha,
|
||||
space,
|
||||
});
|
||||
case 'xyz':
|
||||
case 'xyz-d65':
|
||||
case 'xyz-d50':
|
||||
return new color_1.SassColor({
|
||||
x: channel1,
|
||||
y: channel2,
|
||||
z: channel3,
|
||||
alpha,
|
||||
space,
|
||||
});
|
||||
default:
|
||||
throw utils.compilerError(`Unknown color space "${color.space}".`);
|
||||
}
|
||||
}
|
||||
case 'list': {
|
||||
const list = value.value.value;
|
||||
const separator = this.deprotofySeparator(list.separator);
|
||||
if (separator === null && list.contents.length > 1) {
|
||||
throw utils.compilerError(`Value.List ${list} can't have an undecided separator because it ` +
|
||||
`has ${list.contents.length} elements`);
|
||||
}
|
||||
return new list_1.SassList(list.contents.map(element => this.deprotofy(element)), { separator, brackets: list.hasBrackets });
|
||||
}
|
||||
case 'argumentList': {
|
||||
const list = value.value.value;
|
||||
const separator = this.deprotofySeparator(list.separator);
|
||||
if (separator === null && list.contents.length > 1) {
|
||||
throw utils.compilerError(`Value.List ${list} can't have an undecided separator because it ` +
|
||||
`has ${list.contents.length} elements`);
|
||||
}
|
||||
const result = new argument_list_1.SassArgumentList(list.contents.map(element => this.deprotofy(element)), (0, immutable_1.OrderedMap)(Object.entries(list.keywords).map(([key, value]) => [
|
||||
key,
|
||||
this.deprotofy(value),
|
||||
])), separator, list.id, this.functions.compileContext);
|
||||
this.argumentLists.push(result);
|
||||
return result;
|
||||
}
|
||||
case 'map':
|
||||
return new map_1.SassMap((0, immutable_1.OrderedMap)(value.value.value.entries.map(entry => {
|
||||
const key = entry.key;
|
||||
if (!key)
|
||||
throw utils.mandatoryError('Value.Map.Entry.key');
|
||||
const value = entry.value;
|
||||
if (!value)
|
||||
throw utils.mandatoryError('Value.Map.Entry.value');
|
||||
return [this.deprotofy(key), this.deprotofy(value)];
|
||||
})));
|
||||
case 'compilerFunction':
|
||||
return new function_1.SassFunction(value.value.value.id, this.functions.compileContext);
|
||||
case 'hostFunction':
|
||||
throw utils.compilerError('The compiler may not send Value.host_function.');
|
||||
case 'compilerMixin':
|
||||
return new mixin_1.SassMixin(value.value.value.id, this.functions.compileContext);
|
||||
case 'calculation':
|
||||
return this.deprotofyCalculation(value.value.value);
|
||||
case 'singleton':
|
||||
switch (value.value.value) {
|
||||
case proto.SingletonValue.TRUE:
|
||||
return boolean_1.sassTrue;
|
||||
case proto.SingletonValue.FALSE:
|
||||
return boolean_1.sassFalse;
|
||||
case proto.SingletonValue.NULL:
|
||||
return null_1.sassNull;
|
||||
}
|
||||
// eslint-disable-next-line no-fallthrough
|
||||
default:
|
||||
throw utils.mandatoryError('Value.value');
|
||||
}
|
||||
}
|
||||
/** Converts `number` to its JS representation. */
|
||||
deprotofyNumber(number) {
|
||||
return new number_1.SassNumber(number.value, {
|
||||
numeratorUnits: number.numerators,
|
||||
denominatorUnits: number.denominators,
|
||||
});
|
||||
}
|
||||
/** Converts `separator` to its JS representation. */
|
||||
deprotofySeparator(separator) {
|
||||
switch (separator) {
|
||||
case proto.ListSeparator.COMMA:
|
||||
return ',';
|
||||
case proto.ListSeparator.SPACE:
|
||||
return ' ';
|
||||
case proto.ListSeparator.SLASH:
|
||||
return '/';
|
||||
case proto.ListSeparator.UNDECIDED:
|
||||
return null;
|
||||
default:
|
||||
throw utils.compilerError(`Unknown separator ${separator}`);
|
||||
}
|
||||
}
|
||||
/** Converts `calculation` to its Sass representation. */
|
||||
deprotofyCalculation(calculation) {
|
||||
switch (calculation.name) {
|
||||
case 'calc':
|
||||
if (calculation.arguments.length !== 1) {
|
||||
throw utils.compilerError('Value.Calculation.arguments must have exactly one argument for calc().');
|
||||
}
|
||||
return calculations_1.SassCalculation.calc(this.deprotofyCalculationValue(calculation.arguments[0]));
|
||||
case 'clamp':
|
||||
if (calculation.arguments.length === 0 ||
|
||||
calculation.arguments.length > 3) {
|
||||
throw utils.compilerError('Value.Calculation.arguments must have 1 to 3 arguments for clamp().');
|
||||
}
|
||||
return calculations_1.SassCalculation.clamp(this.deprotofyCalculationValue(calculation.arguments[0]), calculation.arguments.length > 1
|
||||
? this.deprotofyCalculationValue(calculation.arguments[1])
|
||||
: undefined, calculation.arguments.length > 2
|
||||
? this.deprotofyCalculationValue(calculation.arguments[2])
|
||||
: undefined);
|
||||
case 'min':
|
||||
if (calculation.arguments.length === 0) {
|
||||
throw utils.compilerError('Value.Calculation.arguments must have at least 1 argument for min().');
|
||||
}
|
||||
return calculations_1.SassCalculation.min(calculation.arguments.map(this.deprotofyCalculationValue));
|
||||
case 'max':
|
||||
if (calculation.arguments.length === 0) {
|
||||
throw utils.compilerError('Value.Calculation.arguments must have at least 1 argument for max().');
|
||||
}
|
||||
return calculations_1.SassCalculation.max(calculation.arguments.map(this.deprotofyCalculationValue));
|
||||
default:
|
||||
throw utils.compilerError(`Value.Calculation.name "${calculation.name}" is not a recognized calculation type.`);
|
||||
}
|
||||
}
|
||||
/** Converts `value` to its Sass representation. */
|
||||
deprotofyCalculationValue(value) {
|
||||
switch (value.value.case) {
|
||||
case 'number':
|
||||
return this.deprotofyNumber(value.value.value);
|
||||
case 'calculation':
|
||||
return this.deprotofyCalculation(value.value.value);
|
||||
case 'string':
|
||||
return new string_1.SassString(value.value.value, { quotes: false });
|
||||
case 'operation':
|
||||
return new calculations_1.CalculationOperation(this.deprotofyCalculationOperator(value.value.value.operator), this.deprotofyCalculationValue(value.value.value.left), this.deprotofyCalculationValue(value.value.value.right));
|
||||
case 'interpolation':
|
||||
return new calculations_1.CalculationInterpolation(value.value.value);
|
||||
default:
|
||||
throw utils.mandatoryError('Calculation.CalculationValue.value');
|
||||
}
|
||||
}
|
||||
/** Converts `operator` to its Sass representation. */
|
||||
deprotofyCalculationOperator(operator) {
|
||||
switch (operator) {
|
||||
case proto.CalculationOperator.PLUS:
|
||||
return '+';
|
||||
case proto.CalculationOperator.MINUS:
|
||||
return '-';
|
||||
case proto.CalculationOperator.TIMES:
|
||||
return '*';
|
||||
case proto.CalculationOperator.DIVIDE:
|
||||
return '/';
|
||||
default:
|
||||
throw utils.compilerError(`Unknown CalculationOperator ${operator}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.Protofier = Protofier;
|
||||
//# sourceMappingURL=protofier.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/protofier.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/protofier.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
52
node_modules/sass-embedded/dist/lib/src/request-tracker.js
generated
vendored
Normal file
52
node_modules/sass-embedded/dist/lib/src/request-tracker.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
// Copyright 2020 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.RequestTracker = void 0;
|
||||
/**
|
||||
* Manages pending inbound and outbound requests. Ensures that requests and
|
||||
* responses interact correctly and obey the Embedded Protocol.
|
||||
*/
|
||||
class RequestTracker {
|
||||
// The indices of this array correspond to each pending request's ID. Stores
|
||||
// the response type expected by each request.
|
||||
requests = [];
|
||||
/** The next available request ID. */
|
||||
get nextId() {
|
||||
for (let i = 0; i < this.requests.length; i++) {
|
||||
if (this.requests[i] === undefined || this.requests[i] === null) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return this.requests.length;
|
||||
}
|
||||
/**
|
||||
* Adds an entry for a pending request with ID `id`. The entry stores the
|
||||
* expected response type. Throws an error if the Protocol Error is violated.
|
||||
*/
|
||||
add(id, expectedResponseType) {
|
||||
if (id < 0) {
|
||||
throw Error(`Invalid request ID ${id}.`);
|
||||
}
|
||||
else if (this.requests[id]) {
|
||||
throw Error(`Request ID ${id} is already in use by an in-flight request.`);
|
||||
}
|
||||
this.requests[id] = expectedResponseType;
|
||||
}
|
||||
/**
|
||||
* Resolves a pending request with matching ID `id` and expected response type
|
||||
* `type`. Throws an error if the Protocol Error is violated.
|
||||
*/
|
||||
resolve(id, type) {
|
||||
if (this.requests[id] === undefined || this.requests[id] === null) {
|
||||
throw Error(`Response ID ${id} does not match any pending requests.`);
|
||||
}
|
||||
else if (this.requests[id] !== type) {
|
||||
throw Error(`Response with ID ${id} does not match pending request's type. Expected ${this.requests[id]} but received ${type}.`);
|
||||
}
|
||||
this.requests[id] = null;
|
||||
}
|
||||
}
|
||||
exports.RequestTracker = RequestTracker;
|
||||
//# sourceMappingURL=request-tracker.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/request-tracker.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/request-tracker.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"request-tracker.js","sourceRoot":"","sources":["../../../lib/src/request-tracker.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAIvC;;;GAGG;AACH,MAAa,cAAc;IACzB,4EAA4E;IAC5E,8CAA8C;IAC7B,QAAQ,GAErB,EAAE,CAAC;IAEP,qCAAqC;IACrC,IAAI,MAAM;QACR,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9C,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;gBAChE,OAAO,CAAC,CAAC;YACX,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACH,GAAG,CACD,EAAU,EACV,oBAAgE;QAEhE,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;YACX,MAAM,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;QAC3C,CAAC;aAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;YAC7B,MAAM,KAAK,CACT,cAAc,EAAE,6CAA6C,CAC9D,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,oBAAoB,CAAC;IAC3C,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,EAAU,EAAE,IAAgD;QAClE,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC;YAClE,MAAM,KAAK,CAAC,eAAe,EAAE,uCAAuC,CAAC,CAAC;QACxE,CAAC;aAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC;YACtC,MAAM,KAAK,CACT,oBAAoB,EAAE,oDAAoD,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,iBAAiB,IAAI,GAAG,CACpH,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;IAC3B,CAAC;CACF;AAjDD,wCAiDC"}
|
||||
144
node_modules/sass-embedded/dist/lib/src/utils.js
generated
vendored
Normal file
144
node_modules/sass-embedded/dist/lib/src/utils.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
"use strict";
|
||||
// Copyright 2020 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.thenOr = thenOr;
|
||||
exports.catchOr = catchOr;
|
||||
exports.isNullOrUndefined = isNullOrUndefined;
|
||||
exports.asImmutableList = asImmutableList;
|
||||
exports.compilerError = compilerError;
|
||||
exports.mandatoryError = mandatoryError;
|
||||
exports.hostError = hostError;
|
||||
exports.valueError = valueError;
|
||||
exports.pathToUrlString = pathToUrlString;
|
||||
exports.fileUrlToPathCrossPlatform = fileUrlToPathCrossPlatform;
|
||||
exports.withoutExtension = withoutExtension;
|
||||
exports.protofySyntax = protofySyntax;
|
||||
exports.isErrnoException = isErrnoException;
|
||||
exports.putIfAbsent = putIfAbsent;
|
||||
const immutable_1 = require("immutable");
|
||||
const p = require("path");
|
||||
const url = require("url");
|
||||
const proto = require("./vendor/embedded_sass_pb");
|
||||
/**
|
||||
* The equivalent of `Promise.then()`, except that if the first argument is a
|
||||
* plain value it synchronously invokes `callback()` and returns its result.
|
||||
*/
|
||||
function thenOr(promiseOrValue, callback) {
|
||||
return promiseOrValue instanceof Promise
|
||||
? promiseOrValue.then(callback)
|
||||
: callback(promiseOrValue);
|
||||
}
|
||||
/**
|
||||
* The equivalent of `Promise.catch()`, except that if the first argument throws
|
||||
* synchronously it synchronously invokes `callback()` and returns its result.
|
||||
*/
|
||||
function catchOr(promiseOrValueCallback, callback) {
|
||||
try {
|
||||
const result = promiseOrValueCallback();
|
||||
return result instanceof Promise
|
||||
? result.catch(callback)
|
||||
: result;
|
||||
}
|
||||
catch (error) {
|
||||
return callback(error);
|
||||
}
|
||||
}
|
||||
/** Checks for null or undefined. */
|
||||
function isNullOrUndefined(object) {
|
||||
return object === null || object === undefined;
|
||||
}
|
||||
/** Returns `collection` as an immutable List. */
|
||||
function asImmutableList(collection) {
|
||||
return immutable_1.List.isList(collection) ? collection : (0, immutable_1.List)(collection);
|
||||
}
|
||||
/** Constructs a compiler-caused Error. */
|
||||
function compilerError(message) {
|
||||
return Error(`Compiler caused error: ${message}.`);
|
||||
}
|
||||
/**
|
||||
* Returns a `compilerError()` indicating that the given `field` should have
|
||||
* been included but was not.
|
||||
*/
|
||||
function mandatoryError(field) {
|
||||
return compilerError(`Missing mandatory field ${field}`);
|
||||
}
|
||||
/** Constructs a host-caused Error. */
|
||||
function hostError(message) {
|
||||
return Error(`Compiler reported error: ${message}.`);
|
||||
}
|
||||
/** Constructs an error caused by an invalid value type. */
|
||||
function valueError(message, name) {
|
||||
return Error(name ? `$${name}: ${message}.` : `${message}.`);
|
||||
}
|
||||
// Node changed its implementation of pathToFileURL:
|
||||
// https://github.com/nodejs/node/pull/54545
|
||||
const unsafePathToFileURL = url.pathToFileURL('~').pathname.endsWith('~');
|
||||
/** Converts a (possibly relative) path on the local filesystem to a URL. */
|
||||
function pathToUrlString(path) {
|
||||
if (p.isAbsolute(path))
|
||||
return url.pathToFileURL(path).toString();
|
||||
// percent encode relative path like `pathToFileURL`
|
||||
let fileUrl = encodeURI(path).replace(/[#?]/g, encodeURIComponent);
|
||||
if (unsafePathToFileURL) {
|
||||
fileUrl = fileUrl.replace(/%(5B|5D|5E|7C)/g, decodeURIComponent);
|
||||
}
|
||||
else {
|
||||
fileUrl = fileUrl.replace(/~/g, '%7E');
|
||||
}
|
||||
if (process.platform === 'win32') {
|
||||
fileUrl = fileUrl.replace(/%5C/g, '/');
|
||||
}
|
||||
return fileUrl;
|
||||
}
|
||||
/**
|
||||
* Like `url.fileURLToPath`, but returns the same result for Windows-style file
|
||||
* URLs on all platforms.
|
||||
*/
|
||||
function fileUrlToPathCrossPlatform(fileUrl) {
|
||||
const path = url.fileURLToPath(fileUrl);
|
||||
// Windows file: URLs begin with `file:///C:/` (or another drive letter),
|
||||
// which `fileURLToPath` converts to `"/C:/"` on non-Windows systems. We want
|
||||
// to ensure the behavior is consistent across OSes, so we normalize this back
|
||||
// to a Windows-style path.
|
||||
return /^\/[A-Za-z]:\//.test(path) ? path.substring(1) : path;
|
||||
}
|
||||
/** Returns `path` without an extension, if it had one. */
|
||||
function withoutExtension(path) {
|
||||
const extension = p.extname(path);
|
||||
return path.substring(0, path.length - extension.length);
|
||||
}
|
||||
/** Converts a JS syntax string into a protobuf syntax enum. */
|
||||
function protofySyntax(syntax) {
|
||||
switch (syntax) {
|
||||
case 'scss':
|
||||
return proto.Syntax.SCSS;
|
||||
case 'indented':
|
||||
return proto.Syntax.INDENTED;
|
||||
case 'css':
|
||||
return proto.Syntax.CSS;
|
||||
default:
|
||||
throw new Error(`Unknown syntax: "${syntax}"`);
|
||||
}
|
||||
}
|
||||
/** Returns whether `error` is a NodeJS-style exception with an error code. */
|
||||
function isErrnoException(error) {
|
||||
return error instanceof Error && ('errno' in error || 'code' in error);
|
||||
}
|
||||
/**
|
||||
* Dart-style utility. See
|
||||
* http://go/dart-api/stable/2.8.4/dart-core/Map/putIfAbsent.html.
|
||||
*/
|
||||
function putIfAbsent(map, key, provider) {
|
||||
const val = map.get(key);
|
||||
if (val !== undefined) {
|
||||
return val;
|
||||
}
|
||||
else {
|
||||
const newVal = provider();
|
||||
map.set(key, newVal);
|
||||
return newVal;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=utils.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/utils.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/utils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../lib/src/utils.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;AAwBvC,wBAOC;AAMD,0BAYC;AAGD,8CAIC;AAGD,0CAEC;AAGD,sCAEC;AAMD,wCAEC;AAGD,8BAEC;AAGD,gCAEC;AAOD,0CAiBC;AAMD,gEAQC;AAGD,4CAGC;AAGD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AAG,EAAE,MAAM,CAAC,CAAC;QACrB,OAAO,MAAM,CAAC;IAChB,CAAC;AACH,CAAC"}
|
||||
66
node_modules/sass-embedded/dist/lib/src/value/argument-list.js
generated
vendored
Normal file
66
node_modules/sass-embedded/dist/lib/src/value/argument-list.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
// Copyright 2021 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SassArgumentList = void 0;
|
||||
const immutable_1 = require("immutable");
|
||||
const list_1 = require("./list");
|
||||
class SassArgumentList extends list_1.SassList {
|
||||
/**
|
||||
* The `FunctionCallRequest`-scoped ID of this argument list, used to tell the
|
||||
* compiler which argument lists have had their keywords accessed during a
|
||||
* function call.
|
||||
*
|
||||
* The special undefined indicates an argument list constructed in the host.
|
||||
*
|
||||
* This is marked as public so that the protofier can access it, but it's not
|
||||
* part of the package's public API and should not be accessed by user code.
|
||||
* It may be renamed or removed without warning in the future.
|
||||
*/
|
||||
id;
|
||||
/**
|
||||
* If this argument list is constructed in the compiler, this is the unique
|
||||
* context that the host uses to determine which compilation this argument
|
||||
* list belongs to.
|
||||
*
|
||||
* This is marked as public so that the protofier can access it, but it's not
|
||||
* part of the package's public API and should not be accessed by user code.
|
||||
* It may be renamed or removed without warning in the future.
|
||||
*/
|
||||
compileContext;
|
||||
/**
|
||||
* The argument list's keywords. This isn't exposed directly so that we can
|
||||
* set `keywordsAccessed` when the user reads it.
|
||||
*
|
||||
* This is marked as public so that the protofier can access it, but it's not
|
||||
* part of the package's public API and should not be accessed by user code.
|
||||
* It may be renamed or removed without warning in the future.
|
||||
*/
|
||||
keywordsInternal;
|
||||
_keywordsAccessed = false;
|
||||
/**
|
||||
* Whether the `keywords` getter has been accessed.
|
||||
*
|
||||
* This is marked as public so that the protofier can access it, but it's not
|
||||
* part of the package's public API and should not be accessed by user code.
|
||||
* It may be renamed or removed without warning in the future.
|
||||
*/
|
||||
get keywordsAccessed() {
|
||||
return this._keywordsAccessed;
|
||||
}
|
||||
get keywords() {
|
||||
this._keywordsAccessed = true;
|
||||
return this.keywordsInternal;
|
||||
}
|
||||
constructor(contents, keywords, separator, id, compileContext) {
|
||||
super(contents, { separator });
|
||||
this.keywordsInternal = (0, immutable_1.isOrderedMap)(keywords)
|
||||
? keywords
|
||||
: (0, immutable_1.OrderedMap)(keywords);
|
||||
this.id = id;
|
||||
this.compileContext = compileContext;
|
||||
}
|
||||
}
|
||||
exports.SassArgumentList = SassArgumentList;
|
||||
//# sourceMappingURL=argument-list.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/value/argument-list.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/value/argument-list.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"argument-list.js","sourceRoot":"","sources":["../../../../lib/src/value/argument-list.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,yCAAyD;AAEzD,iCAA+C;AAG/C,MAAa,gBAAiB,SAAQ,eAAQ;IAC5C;;;;;;;;;;OAUG;IACM,EAAE,CAAqB;IAEhC;;;;;;;;OAQG;IACM,cAAc,CAAqB;IAE5C;;;;;;;OAOG;IACM,gBAAgB,CAA4B;IAE7C,iBAAiB,GAAG,KAAK,CAAC;IAElC;;;;;;OAMG;IACH,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IAED,IAAI,QAAQ;QACV,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;QAC9B,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAED,YACE,QAA+B,EAC/B,QAA2D,EAC3D,SAAyB,EACzB,EAAW,EACX,cAAuB;QAEvB,KAAK,CAAC,QAAQ,EAAE,EAAC,SAAS,EAAC,CAAC,CAAC;QAC7B,IAAI,CAAC,gBAAgB,GAAG,IAAA,wBAAY,EAAC,QAAQ,CAAC;YAC5C,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,IAAA,sBAAU,EAAC,QAAQ,CAAC,CAAC;QACzB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;CACF;AAnED,4CAmEC"}
|
||||
69
node_modules/sass-embedded/dist/lib/src/value/boolean.js
generated
vendored
Normal file
69
node_modules/sass-embedded/dist/lib/src/value/boolean.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
"use strict";
|
||||
// Copyright 2021 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.sassFalse = exports.sassTrue = exports.SassBooleanInternal = exports.SassBoolean = void 0;
|
||||
const immutable_1 = require("immutable");
|
||||
const index_1 = require("./index");
|
||||
/**
|
||||
* Sass boolean.
|
||||
*
|
||||
* This is an abstract class that cannot be directly instantiated. Instead,
|
||||
* use the provided {@link sassTrue} and {@link sassFalse} singleton instances.
|
||||
*/
|
||||
class SassBoolean extends index_1.Value {
|
||||
}
|
||||
exports.SassBoolean = SassBoolean;
|
||||
const trueHash = (0, immutable_1.hash)(true);
|
||||
const falseHash = (0, immutable_1.hash)(false);
|
||||
class SassBooleanInternal extends SassBoolean {
|
||||
valueInternal;
|
||||
// Whether callers are allowed to construct this class. This is set to
|
||||
// `false` once the two constants are constructed so that the constructor
|
||||
// throws an error for future calls, in accordance with the legacy API.
|
||||
static constructionAllowed = true;
|
||||
constructor(valueInternal) {
|
||||
super();
|
||||
this.valueInternal = valueInternal;
|
||||
if (!SassBooleanInternal.constructionAllowed) {
|
||||
throw ("new sass.types.Boolean() isn't allowed.\n" +
|
||||
'Use sass.types.Boolean.TRUE or sass.types.Boolean.FALSE instead.');
|
||||
}
|
||||
Object.freeze(this);
|
||||
}
|
||||
get value() {
|
||||
return this.valueInternal;
|
||||
}
|
||||
get isTruthy() {
|
||||
return this.value;
|
||||
}
|
||||
assertBoolean() {
|
||||
return this;
|
||||
}
|
||||
equals(other) {
|
||||
return this === other;
|
||||
}
|
||||
hashCode() {
|
||||
return this.value ? trueHash : falseHash;
|
||||
}
|
||||
toString() {
|
||||
return this.value ? 'sassTrue' : 'sassFalse';
|
||||
}
|
||||
// Legacy API support
|
||||
static TRUE;
|
||||
static FALSE;
|
||||
getValue() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
exports.SassBooleanInternal = SassBooleanInternal;
|
||||
/** The singleton instance of SassScript true. */
|
||||
exports.sassTrue = new SassBooleanInternal(true);
|
||||
/** The singleton instance of SassScript false. */
|
||||
exports.sassFalse = new SassBooleanInternal(false);
|
||||
// Legacy API support
|
||||
SassBooleanInternal.constructionAllowed = false;
|
||||
SassBooleanInternal.TRUE = exports.sassTrue;
|
||||
SassBooleanInternal.FALSE = exports.sassFalse;
|
||||
//# sourceMappingURL=boolean.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/value/boolean.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/value/boolean.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../../../lib/src/value/boolean.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,yCAA+B;AAE/B,mCAA8B;AAE9B;;;;;GAKG;AACH,MAAsB,WAAY,SAAQ,aAAK;CAE9C;AAFD,kCAEC;AAED,MAAM,QAAQ,GAAG,IAAA,gBAAI,EAAC,IAAI,CAAC,CAAC;AAC5B,MAAM,SAAS,GAAG,IAAA,gBAAI,EAAC,KAAK,CAAC,CAAC;AAE9B,MAAa,mBAAoB,SAAQ,WAAW;IAMrB;IAL7B,sEAAsE;IACtE,yEAAyE;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AAS,CAAC"}
|
||||
108
node_modules/sass-embedded/dist/lib/src/value/calculations.js
generated
vendored
Normal file
108
node_modules/sass-embedded/dist/lib/src/value/calculations.js
generated
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
"use strict";
|
||||
// Copyright 2023 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CalculationInterpolation = exports.CalculationOperation = exports.SassCalculation = void 0;
|
||||
const immutable_1 = require("immutable");
|
||||
const index_1 = require("./index");
|
||||
const string_1 = require("./string");
|
||||
function assertCalculationValue(value) {
|
||||
if (value instanceof string_1.SassString && value.hasQuotes) {
|
||||
throw new Error(`Expected ${value} to be an unquoted string.`);
|
||||
}
|
||||
}
|
||||
function isValidClampArg(value) {
|
||||
return (value instanceof CalculationInterpolation ||
|
||||
(value instanceof string_1.SassString && !value.hasQuotes));
|
||||
}
|
||||
/* A SassScript calculation */
|
||||
class SassCalculation extends index_1.Value {
|
||||
name;
|
||||
arguments;
|
||||
constructor(name, args) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.arguments = (0, immutable_1.List)(args);
|
||||
}
|
||||
static calc(argument) {
|
||||
assertCalculationValue(argument);
|
||||
return new SassCalculation('calc', [argument]);
|
||||
}
|
||||
static min(args) {
|
||||
args.forEach(assertCalculationValue);
|
||||
return new SassCalculation('min', args);
|
||||
}
|
||||
static max(args) {
|
||||
args.forEach(assertCalculationValue);
|
||||
return new SassCalculation('max', args);
|
||||
}
|
||||
static clamp(min, value, max) {
|
||||
if ((value === undefined && !isValidClampArg(min)) ||
|
||||
(max === undefined && ![min, value].some(x => x && isValidClampArg(x)))) {
|
||||
throw new Error('Argument must be an unquoted SassString or CalculationInterpolation.');
|
||||
}
|
||||
const args = [min];
|
||||
if (value !== undefined)
|
||||
args.push(value);
|
||||
if (max !== undefined)
|
||||
args.push(max);
|
||||
args.forEach(assertCalculationValue);
|
||||
return new SassCalculation('clamp', args);
|
||||
}
|
||||
assertCalculation() {
|
||||
return this;
|
||||
}
|
||||
equals(other) {
|
||||
return (other instanceof SassCalculation &&
|
||||
this.name === other.name &&
|
||||
this.arguments.equals(other.arguments));
|
||||
}
|
||||
hashCode() {
|
||||
return (0, immutable_1.hash)(this.name) ^ this.arguments.hashCode();
|
||||
}
|
||||
toString() {
|
||||
return `${this.name}(${this.arguments.join(', ')})`;
|
||||
}
|
||||
}
|
||||
exports.SassCalculation = SassCalculation;
|
||||
const operators = ['+', '-', '*', '/'];
|
||||
class CalculationOperation {
|
||||
operator;
|
||||
left;
|
||||
right;
|
||||
constructor(operator, left, right) {
|
||||
this.operator = operator;
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
if (!operators.includes(operator)) {
|
||||
throw new Error(`Invalid operator: ${operator}`);
|
||||
}
|
||||
assertCalculationValue(left);
|
||||
assertCalculationValue(right);
|
||||
}
|
||||
equals(other) {
|
||||
return (other instanceof CalculationOperation &&
|
||||
this.operator === other.operator &&
|
||||
this.left === other.left &&
|
||||
this.right === other.right);
|
||||
}
|
||||
hashCode() {
|
||||
return (0, immutable_1.hash)(this.operator) ^ (0, immutable_1.hash)(this.left) ^ (0, immutable_1.hash)(this.right);
|
||||
}
|
||||
}
|
||||
exports.CalculationOperation = CalculationOperation;
|
||||
class CalculationInterpolation {
|
||||
value;
|
||||
constructor(value) {
|
||||
this.value = value;
|
||||
}
|
||||
equals(other) {
|
||||
return (other instanceof CalculationInterpolation && this.value === other.value);
|
||||
}
|
||||
hashCode() {
|
||||
return (0, immutable_1.hash)(this.value);
|
||||
}
|
||||
}
|
||||
exports.CalculationInterpolation = CalculationInterpolation;
|
||||
//# sourceMappingURL=calculations.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/value/calculations.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/value/calculations.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"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D,4DAYC"}
|
||||
874
node_modules/sass-embedded/dist/lib/src/value/color.js
generated
vendored
Normal file
874
node_modules/sass-embedded/dist/lib/src/value/color.js
generated
vendored
Normal file
@@ -0,0 +1,874 @@
|
||||
"use strict";
|
||||
// Copyright 2021 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SassColor = void 0;
|
||||
const index_1 = require("./index");
|
||||
const deprecations_1 = require("../deprecations");
|
||||
const utils_1 = require("../utils");
|
||||
const utils_2 = require("./utils");
|
||||
const immutable_1 = require("immutable");
|
||||
const colorjs_io_1 = require("colorjs.io");
|
||||
/** Legacy determination of color space by channel name. */
|
||||
function getColorSpace(options) {
|
||||
if (typeof options.red === 'number')
|
||||
return 'rgb';
|
||||
if (typeof options.saturation === 'number')
|
||||
return 'hsl';
|
||||
if (typeof options.whiteness === 'number')
|
||||
return 'hwb';
|
||||
throw (0, utils_1.valueError)('No color space found');
|
||||
}
|
||||
/**
|
||||
* Convert from the ColorJS representation of a missing component (`NaN`) to
|
||||
* `null`.
|
||||
*/
|
||||
function NaNtoNull(val) {
|
||||
return Number.isNaN(val) ? null : val;
|
||||
}
|
||||
/**
|
||||
* Convert from the ColorJS representation of a missing component (`NaN`) to
|
||||
* `0`.
|
||||
*/
|
||||
function NaNtoZero(val) {
|
||||
return Number.isNaN(val) ? 0 : val;
|
||||
}
|
||||
/** Convert from sRGB (0-1) to RGB (0-255) units. */
|
||||
function coordToRgb(val) {
|
||||
return val * 255;
|
||||
}
|
||||
/** Normalize `hue` values to be within the range `[0, 360)`. */
|
||||
function normalizeHue(val) {
|
||||
return (0, utils_2.positiveMod)(val, 360);
|
||||
}
|
||||
/**
|
||||
* Normalize discrepancies between Sass color spaces and ColorJS color space
|
||||
* ids, converting Sass values to ColorJS values.
|
||||
*/
|
||||
function encodeSpaceForColorJs(space) {
|
||||
switch (space) {
|
||||
case 'rgb':
|
||||
return 'srgb';
|
||||
case 'a98-rgb':
|
||||
return 'a98rgb';
|
||||
case 'display-p3':
|
||||
return 'p3';
|
||||
case 'prophoto-rgb':
|
||||
return 'prophoto';
|
||||
}
|
||||
return space;
|
||||
}
|
||||
/**
|
||||
* Normalize discrepancies between Sass's [GamutMapMethod] and Color.js's
|
||||
* `method` option.
|
||||
*/
|
||||
function encodeGamutMapMethodForColorJs(method) {
|
||||
return method === 'local-minde' ? 'css' : method;
|
||||
}
|
||||
/**
|
||||
* Normalize discrepancies between Sass color spaces and ColorJS color space
|
||||
* ids, converting ColorJS values to Sass values.
|
||||
*/
|
||||
function decodeSpaceFromColorJs(space, isRgb = false) {
|
||||
switch (space) {
|
||||
case 'srgb':
|
||||
return isRgb ? 'rgb' : space;
|
||||
case 'xyz-d65':
|
||||
return 'xyz';
|
||||
case 'a98rgb':
|
||||
return 'a98-rgb';
|
||||
case 'p3':
|
||||
return 'display-p3';
|
||||
case 'prophoto':
|
||||
return 'prophoto-rgb';
|
||||
}
|
||||
return space;
|
||||
}
|
||||
/**
|
||||
* Normalize discrepancies between Sass channel names and ColorJS channel ids,
|
||||
* converting Sass values to ColorJS values.
|
||||
*
|
||||
* @TODO Waiting on a new release of ColorJS that allows Lab spaces to accept
|
||||
* `lightness` instead of only `l` and not as a channel name.
|
||||
* Fixed in: https://github.com/LeaVerou/color.js/pull/348
|
||||
*/
|
||||
function encodeChannelForColorJs(channel) {
|
||||
if (channel === 'lightness')
|
||||
return 'l';
|
||||
return channel;
|
||||
}
|
||||
/**
|
||||
* Implement our own check of channel name validity for a given space, because
|
||||
* ColorJS allows e.g. `b` for any of `blue`, `blackness`, or `b` channels.
|
||||
*/
|
||||
function validateChannelInSpace(channel, space) {
|
||||
if (channel === 'alpha')
|
||||
return;
|
||||
let valid = false;
|
||||
switch (space) {
|
||||
case 'rgb':
|
||||
case 'srgb':
|
||||
case 'srgb-linear':
|
||||
case 'display-p3':
|
||||
case 'a98-rgb':
|
||||
case 'prophoto-rgb':
|
||||
case 'rec2020':
|
||||
valid = ['red', 'green', 'blue'].includes(channel);
|
||||
break;
|
||||
case 'hsl':
|
||||
valid = ['hue', 'saturation', 'lightness'].includes(channel);
|
||||
break;
|
||||
case 'hwb':
|
||||
valid = ['hue', 'whiteness', 'blackness'].includes(channel);
|
||||
break;
|
||||
case 'lab':
|
||||
case 'oklab':
|
||||
valid = ['lightness', 'a', 'b'].includes(channel);
|
||||
break;
|
||||
case 'lch':
|
||||
case 'oklch':
|
||||
valid = ['lightness', 'chroma', 'hue'].includes(channel);
|
||||
break;
|
||||
case 'xyz':
|
||||
case 'xyz-d65':
|
||||
case 'xyz-d50':
|
||||
valid = ['x', 'y', 'z'].includes(channel);
|
||||
break;
|
||||
}
|
||||
if (!valid) {
|
||||
throw (0, utils_1.valueError)(`Unknown channel name "${channel}" for color space "${space}".`);
|
||||
}
|
||||
}
|
||||
/** Determine whether the given space is a polar color space. */
|
||||
function isPolarColorSpace(space) {
|
||||
switch (space) {
|
||||
case 'hsl':
|
||||
case 'hwb':
|
||||
case 'lch':
|
||||
case 'oklch':
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Convert from ColorJS coordinates (which use `NaN` for missing components, and
|
||||
* a range of `0-1` for `rgb` channel values) to Sass Color coordinates (which
|
||||
* use `null` for missing components, and a range of `0-255` for `rgb` channel
|
||||
* values).
|
||||
*/
|
||||
function decodeCoordsFromColorJs(coords, // ColorJS coordinates
|
||||
isRgb = false) {
|
||||
let newCoords = coords;
|
||||
// If this color is in the `rgb` space, convert channel values to `0-255`
|
||||
if (isRgb)
|
||||
newCoords = newCoords.map(coordToRgb);
|
||||
// Convert `NaN` values to `null`
|
||||
return newCoords.map(NaNtoNull);
|
||||
}
|
||||
/** Returns `true` if `val` is a `number` or `null`. */
|
||||
function isNumberOrNull(val) {
|
||||
return val === null || typeof val === 'number';
|
||||
}
|
||||
/**
|
||||
* Emit deprecation warnings when legacy color spaces set `alpha` or channel
|
||||
* values to `null` without explicitly setting the `space`.
|
||||
*/
|
||||
function checkChangeDeprecations(options, channels) {
|
||||
if (options.alpha === null)
|
||||
emitNullAlphaDeprecation();
|
||||
for (const channel of channels) {
|
||||
if (options[channel] === null)
|
||||
emitColor4ApiChangeNullDeprecation(channel);
|
||||
}
|
||||
}
|
||||
/** Warn users about legacy color channel getters. */
|
||||
function emitColor4ApiGetterDeprecation(name) {
|
||||
(0, deprecations_1.warnForHostSideDeprecation)(`\`${name}\` is deprecated, use \`channel\` instead.` +
|
||||
'\n' +
|
||||
'More info: https://sass-lang.com/d/color-4-api', deprecations_1.deprecations['color-4-api']);
|
||||
}
|
||||
/**
|
||||
* Warn users about changing channels not in the current color space without
|
||||
* explicitly setting `space`.
|
||||
*/
|
||||
function emitColor4ApiChangeSpaceDeprecation() {
|
||||
(0, deprecations_1.warnForHostSideDeprecation)("Changing a channel not in this color's space without explicitly " +
|
||||
'specifying the `space` option is deprecated.' +
|
||||
'\n' +
|
||||
'More info: https://sass-lang.com/d/color-4-api', deprecations_1.deprecations['color-4-api']);
|
||||
}
|
||||
/** Warn users about `null` channel values without setting `space`. */
|
||||
function emitColor4ApiChangeNullDeprecation(channel) {
|
||||
(0, deprecations_1.warnForHostSideDeprecation)(`Passing \`${channel}: null\` without setting \`space\` is deprecated.` +
|
||||
'\n' +
|
||||
'More info: https://sass-lang.com/d/color-4-api', deprecations_1.deprecations['color-4-api']);
|
||||
}
|
||||
/** Warn users about null-alpha deprecation. */
|
||||
function emitNullAlphaDeprecation() {
|
||||
(0, deprecations_1.warnForHostSideDeprecation)('Passing `alpha: null` without setting `space` is deprecated.' +
|
||||
'\n' +
|
||||
'More info: https://sass-lang.com/d/null-alpha', deprecations_1.deprecations['null-alpha']);
|
||||
}
|
||||
/**
|
||||
* Determines whether the options passed to the Constructor include an existing
|
||||
* ColorJS color object.
|
||||
*/
|
||||
function optionsHaveColor(opts) {
|
||||
return opts.color instanceof colorjs_io_1.default;
|
||||
}
|
||||
/** A SassScript color. */
|
||||
class SassColor extends index_1.Value {
|
||||
// ColorJS color object
|
||||
color;
|
||||
// Boolean indicating whether this color is in RGB format
|
||||
//
|
||||
// ColorJS treats `rgb` as an output format of the `srgb` color space, while
|
||||
// Sass treats it as its own color space. By internally tracking whether this
|
||||
// color is `rgb` or not, we can use `srgb` consistently for ColorJS while
|
||||
// still returning expected `rgb` values for Sass users.
|
||||
isRgb = false;
|
||||
// Names for the channels of this color
|
||||
channel0Id;
|
||||
channel1Id;
|
||||
channel2Id;
|
||||
// Sets channel names based on this color's color space
|
||||
setChannelIds(space) {
|
||||
switch (space) {
|
||||
case 'rgb':
|
||||
case 'srgb':
|
||||
case 'srgb-linear':
|
||||
case 'display-p3':
|
||||
case 'a98-rgb':
|
||||
case 'prophoto-rgb':
|
||||
case 'rec2020':
|
||||
this.channel0Id = 'red';
|
||||
this.channel1Id = 'green';
|
||||
this.channel2Id = 'blue';
|
||||
break;
|
||||
case 'hsl':
|
||||
this.channel0Id = 'hue';
|
||||
this.channel1Id = 'saturation';
|
||||
this.channel2Id = 'lightness';
|
||||
break;
|
||||
case 'hwb':
|
||||
this.channel0Id = 'hue';
|
||||
this.channel1Id = 'whiteness';
|
||||
this.channel2Id = 'blackness';
|
||||
break;
|
||||
case 'lab':
|
||||
case 'oklab':
|
||||
this.channel0Id = 'lightness';
|
||||
this.channel1Id = 'a';
|
||||
this.channel2Id = 'b';
|
||||
break;
|
||||
case 'lch':
|
||||
case 'oklch':
|
||||
this.channel0Id = 'lightness';
|
||||
this.channel1Id = 'chroma';
|
||||
this.channel2Id = 'hue';
|
||||
break;
|
||||
case 'xyz':
|
||||
case 'xyz-d65':
|
||||
case 'xyz-d50':
|
||||
this.channel0Id = 'x';
|
||||
this.channel1Id = 'y';
|
||||
this.channel2Id = 'z';
|
||||
break;
|
||||
}
|
||||
}
|
||||
constructor(optionsMaybeWithColor) {
|
||||
super();
|
||||
let options;
|
||||
// Use existing ColorJS color object from options for the new SassColor
|
||||
if (optionsHaveColor(optionsMaybeWithColor)) {
|
||||
const { color, space } = optionsMaybeWithColor;
|
||||
if (space === 'rgb')
|
||||
this.isRgb = true;
|
||||
this.setChannelIds(space);
|
||||
this.color = color;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
options = optionsMaybeWithColor;
|
||||
}
|
||||
const space = options.space ?? getColorSpace(options);
|
||||
this.setChannelIds(space);
|
||||
if (space === 'rgb')
|
||||
this.isRgb = true;
|
||||
let alpha;
|
||||
if (options.alpha === null) {
|
||||
if (!options.space)
|
||||
emitNullAlphaDeprecation();
|
||||
alpha = NaN;
|
||||
}
|
||||
else if (options.alpha === undefined) {
|
||||
alpha = 1;
|
||||
}
|
||||
else {
|
||||
alpha = (0, utils_2.fuzzyAssertInRange)(options.alpha, 0, 1, 'alpha');
|
||||
}
|
||||
switch (space) {
|
||||
case 'rgb':
|
||||
case 'srgb': {
|
||||
const red = options.red ?? NaN;
|
||||
const green = options.green ?? NaN;
|
||||
const blue = options.blue ?? NaN;
|
||||
if (this.isRgb) {
|
||||
this.color = new colorjs_io_1.default({
|
||||
spaceId: encodeSpaceForColorJs(space),
|
||||
// convert from 0-255 to 0-1
|
||||
coords: [red / 255, green / 255, blue / 255],
|
||||
alpha,
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.color = new colorjs_io_1.default({
|
||||
spaceId: encodeSpaceForColorJs(space),
|
||||
coords: [red, green, blue],
|
||||
alpha,
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'srgb-linear':
|
||||
case 'display-p3':
|
||||
case 'a98-rgb':
|
||||
case 'prophoto-rgb':
|
||||
case 'rec2020':
|
||||
this.color = new colorjs_io_1.default({
|
||||
spaceId: encodeSpaceForColorJs(space),
|
||||
coords: [
|
||||
options.red ?? NaN,
|
||||
options.green ?? NaN,
|
||||
options.blue ?? NaN,
|
||||
],
|
||||
alpha,
|
||||
});
|
||||
break;
|
||||
case 'hsl': {
|
||||
let hue = normalizeHue(options.hue ?? NaN);
|
||||
let saturation = options.saturation ?? NaN;
|
||||
const lightness = options.lightness ?? NaN;
|
||||
if (!Number.isNaN(saturation) && (0, utils_2.fuzzyLessThan)(saturation, 0)) {
|
||||
saturation = Math.abs(saturation);
|
||||
hue = (hue + 180) % 360;
|
||||
}
|
||||
this.color = new colorjs_io_1.default({
|
||||
spaceId: encodeSpaceForColorJs(space),
|
||||
coords: [hue, saturation, lightness],
|
||||
alpha,
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'hwb': {
|
||||
const hue = normalizeHue(options.hue ?? NaN);
|
||||
const whiteness = options.whiteness ?? NaN;
|
||||
const blackness = options.blackness ?? NaN;
|
||||
this.color = new colorjs_io_1.default({
|
||||
spaceId: encodeSpaceForColorJs(space),
|
||||
coords: [hue, whiteness, blackness],
|
||||
alpha,
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'lab':
|
||||
case 'oklab': {
|
||||
const lightness = options.lightness ?? NaN;
|
||||
const a = options.a ?? NaN;
|
||||
const b = options.b ?? NaN;
|
||||
this.color = new colorjs_io_1.default({
|
||||
spaceId: encodeSpaceForColorJs(space),
|
||||
coords: [lightness, a, b],
|
||||
alpha,
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'lch':
|
||||
case 'oklch': {
|
||||
const lightness = options.lightness ?? NaN;
|
||||
let chroma = options.chroma ?? NaN;
|
||||
let hue = normalizeHue(options.hue ?? NaN);
|
||||
if (!Number.isNaN(chroma) && (0, utils_2.fuzzyLessThan)(chroma, 0)) {
|
||||
chroma = Math.abs(chroma);
|
||||
hue = (hue + 180) % 360;
|
||||
}
|
||||
this.color = new colorjs_io_1.default({
|
||||
spaceId: encodeSpaceForColorJs(space),
|
||||
coords: [lightness, chroma, hue],
|
||||
alpha,
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'xyz':
|
||||
case 'xyz-d65':
|
||||
case 'xyz-d50':
|
||||
this.color = new colorjs_io_1.default({
|
||||
spaceId: encodeSpaceForColorJs(space),
|
||||
coords: [options.x ?? NaN, options.y ?? NaN, options.z ?? NaN],
|
||||
alpha,
|
||||
});
|
||||
break;
|
||||
}
|
||||
// @TODO Waiting on new release of ColorJS that includes allowing `alpha`
|
||||
// to be `NaN` on initial construction.
|
||||
// Fixed in: https://github.com/LeaVerou/color.js/commit/08b39c180565ae61408ad737d91bd71a1f79d3df
|
||||
if (Number.isNaN(alpha)) {
|
||||
this.color.alpha = NaN;
|
||||
}
|
||||
}
|
||||
/** This color's alpha channel, between `0` and `1`. */
|
||||
get alpha() {
|
||||
return NaNtoZero(this.color.alpha);
|
||||
}
|
||||
/** The name of this color's color space. */
|
||||
get space() {
|
||||
return decodeSpaceFromColorJs(this.color.spaceId, this.isRgb);
|
||||
}
|
||||
/**
|
||||
* A boolean indicating whether this color is in a legacy color space (`rgb`,
|
||||
* `hsl`, or `hwb`).
|
||||
*/
|
||||
get isLegacy() {
|
||||
return ['rgb', 'hsl', 'hwb'].includes(this.space);
|
||||
}
|
||||
/**
|
||||
* A list of this color's channel values (excluding alpha), with [missing
|
||||
* channels] converted to `null`.
|
||||
*
|
||||
* [missing channels]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
|
||||
*/
|
||||
get channelsOrNull() {
|
||||
let coords = this.color.coords;
|
||||
if (this.space === 'rgb') {
|
||||
coords = coords.map(coordToRgb);
|
||||
}
|
||||
return (0, immutable_1.List)(coords.map(NaNtoNull));
|
||||
}
|
||||
/**
|
||||
* A list of this color's channel values (excluding alpha), with [missing
|
||||
* channels] converted to `0`.
|
||||
*
|
||||
* [missing channels]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
|
||||
*/
|
||||
get channels() {
|
||||
let coords = this.color.coords;
|
||||
if (this.space === 'rgb') {
|
||||
coords = coords.map(coordToRgb);
|
||||
}
|
||||
return (0, immutable_1.List)(coords.map(NaNtoZero));
|
||||
}
|
||||
/**
|
||||
* This color's red channel in the RGB color space, between `0` and `255`.
|
||||
*
|
||||
* @deprecated Use {@link channel} instead.
|
||||
*/
|
||||
get red() {
|
||||
emitColor4ApiGetterDeprecation('red');
|
||||
const val = NaNtoZero(coordToRgb(this.color.srgb.red));
|
||||
return (0, utils_2.fuzzyRound)(val);
|
||||
}
|
||||
/**
|
||||
* This color's green channel in the RGB color space, between `0` and `255`.
|
||||
*
|
||||
* @deprecated Use {@link channel} instead.
|
||||
*/
|
||||
get green() {
|
||||
emitColor4ApiGetterDeprecation('green');
|
||||
const val = NaNtoZero(coordToRgb(this.color.srgb.green));
|
||||
return (0, utils_2.fuzzyRound)(val);
|
||||
}
|
||||
/**
|
||||
* This color's blue channel in the RGB color space, between `0` and `255`.
|
||||
*
|
||||
* @deprecated Use {@link channel} instead.
|
||||
*/
|
||||
get blue() {
|
||||
emitColor4ApiGetterDeprecation('blue');
|
||||
const val = NaNtoZero(coordToRgb(this.color.srgb.blue));
|
||||
return (0, utils_2.fuzzyRound)(val);
|
||||
}
|
||||
/**
|
||||
* This color's hue in the HSL color space, between `0` and `360`.
|
||||
*
|
||||
* @deprecated Use {@link channel} instead.
|
||||
*/
|
||||
get hue() {
|
||||
emitColor4ApiGetterDeprecation('hue');
|
||||
return NaNtoZero(this.color.hsl.hue);
|
||||
}
|
||||
/**
|
||||
* This color's saturation in the HSL color space, between `0` and `100`.
|
||||
*
|
||||
* @deprecated Use {@link channel} instead.
|
||||
*/
|
||||
get saturation() {
|
||||
emitColor4ApiGetterDeprecation('saturation');
|
||||
return NaNtoZero(this.color.hsl.saturation);
|
||||
}
|
||||
/**
|
||||
* This color's lightness in the HSL color space, between `0` and `100`.
|
||||
*
|
||||
* @deprecated Use {@link channel} instead.
|
||||
*/
|
||||
get lightness() {
|
||||
emitColor4ApiGetterDeprecation('lightness');
|
||||
return NaNtoZero(this.color.hsl.lightness);
|
||||
}
|
||||
/**
|
||||
* This color's whiteness in the HWB color space, between `0` and `100`.
|
||||
*
|
||||
* @deprecated Use {@link channel} instead.
|
||||
*/
|
||||
get whiteness() {
|
||||
emitColor4ApiGetterDeprecation('whiteness');
|
||||
return NaNtoZero(this.color.hwb.whiteness);
|
||||
}
|
||||
/**
|
||||
* This color's blackness in the HWB color space, between `0` and `100`.
|
||||
*
|
||||
* @deprecated Use {@link channel} instead.
|
||||
*/
|
||||
get blackness() {
|
||||
emitColor4ApiGetterDeprecation('blackness');
|
||||
return NaNtoZero(this.color.hwb.blackness);
|
||||
}
|
||||
assertColor() {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Returns a new color that's the result of converting this color to the
|
||||
* specified `space`.
|
||||
*/
|
||||
toSpace(space) {
|
||||
if (space === this.space)
|
||||
return this;
|
||||
const color = this.color.to(encodeSpaceForColorJs(space));
|
||||
return new SassColor({ color, space });
|
||||
}
|
||||
/**
|
||||
* Returns a boolean indicating whether this color is in-gamut (as opposed to
|
||||
* having one or more of its channels out of bounds) for the specified
|
||||
* `space`, or its current color space if `space` is not specified.
|
||||
*/
|
||||
isInGamut(space) {
|
||||
return this.color.inGamut(encodeSpaceForColorJs(space));
|
||||
}
|
||||
/**
|
||||
* Returns a copy of this color, modified so it is in-gamut for the specified
|
||||
* `space`—or the current color space if `space` is not specified—using
|
||||
* `method` to map out-of-gamut colors into the desired gamut.
|
||||
*/
|
||||
toGamut({ space, method, }) {
|
||||
if (this.isInGamut(space))
|
||||
return this;
|
||||
const color = this.color.clone().toGamut({
|
||||
space: encodeSpaceForColorJs(space),
|
||||
method: encodeGamutMapMethodForColorJs(method),
|
||||
});
|
||||
return new SassColor({ color, space: space ?? this.space });
|
||||
}
|
||||
channel(channel, options) {
|
||||
if (channel === 'alpha')
|
||||
return this.alpha;
|
||||
let val;
|
||||
const space = options?.space ?? this.space;
|
||||
validateChannelInSpace(channel, space);
|
||||
if (options?.space) {
|
||||
val = this.color.get({
|
||||
space: encodeSpaceForColorJs(options.space),
|
||||
coordId: encodeChannelForColorJs(channel),
|
||||
});
|
||||
}
|
||||
else {
|
||||
val = this.color.get({
|
||||
space: this.color.spaceId,
|
||||
coordId: encodeChannelForColorJs(channel),
|
||||
});
|
||||
}
|
||||
if (space === 'rgb')
|
||||
val = coordToRgb(val);
|
||||
return NaNtoZero(val);
|
||||
}
|
||||
/**
|
||||
* Returns a boolean indicating whether a given channel value is a [missing
|
||||
* channel].
|
||||
*
|
||||
* [missing channel]: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#missing_color_components
|
||||
*/
|
||||
isChannelMissing(channel) {
|
||||
if (channel === 'alpha')
|
||||
return Number.isNaN(this.color.alpha);
|
||||
validateChannelInSpace(channel, this.space);
|
||||
return Number.isNaN(this.color.get({
|
||||
space: this.color.spaceId,
|
||||
coordId: encodeChannelForColorJs(channel),
|
||||
}));
|
||||
}
|
||||
isChannelPowerless(channel, options) {
|
||||
if (channel === 'alpha')
|
||||
return false;
|
||||
const color = options?.space ? this.toSpace(options.space) : this;
|
||||
validateChannelInSpace(channel, color.space);
|
||||
const channels = color.channels.toArray();
|
||||
switch (channel) {
|
||||
case color.channel0Id:
|
||||
if (color.space === 'hsl')
|
||||
return (0, utils_2.fuzzyEquals)(channels[1], 0);
|
||||
if (color.space === 'hwb') {
|
||||
return (0, utils_2.fuzzyGreaterThanOrEquals)(channels[1] + channels[2], 100);
|
||||
}
|
||||
return false;
|
||||
case color.channel2Id:
|
||||
switch (color.space) {
|
||||
case 'lch':
|
||||
case 'oklch':
|
||||
return (0, utils_2.fuzzyEquals)(channels[1], 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Returns a color partway between this color and `color2` according to
|
||||
* `method`, as defined by the CSS Color 4 [color interpolation] procedure.
|
||||
*
|
||||
* [color interpolation]: https://www.w3.org/TR/css-color-4/#interpolation
|
||||
*
|
||||
* If `method` is missing and this color is in a polar color space (HSL, HWB,
|
||||
* LCH, and Oklch spaces), `method` defaults to "shorter".
|
||||
*
|
||||
* The `weight` is a number between 0 and 1 that indicates how much of this
|
||||
* color should be in the resulting color. If omitted, it defaults to 0.5.
|
||||
*/
|
||||
interpolate(color2, options) {
|
||||
const hueInterpolationMethod = options?.method ??
|
||||
(isPolarColorSpace(this.space) ? 'shorter' : undefined);
|
||||
const weight = options?.weight ?? 0.5;
|
||||
if ((0, utils_2.fuzzyEquals)(weight, 0))
|
||||
return color2;
|
||||
if ((0, utils_2.fuzzyEquals)(weight, 1))
|
||||
return this;
|
||||
if (weight < 0 || weight > 1) {
|
||||
throw (0, utils_1.valueError)(`Expected \`weight\` between \`0\` and \`1\`, received \`${weight}\`.`);
|
||||
}
|
||||
// ColorJS inverses the `weight` argument, where `0` is `this` and `1` is
|
||||
// `color2`.
|
||||
const color = this.color.mix(color2.color, 1 - weight, {
|
||||
space: encodeSpaceForColorJs(this.space),
|
||||
hue: hueInterpolationMethod,
|
||||
});
|
||||
const coords = decodeCoordsFromColorJs(color.coords, this.space === 'rgb');
|
||||
return new SassColor({
|
||||
space: this.space,
|
||||
[this.channel0Id]: coords[0],
|
||||
[this.channel1Id]: coords[1],
|
||||
[this.channel2Id]: coords[2],
|
||||
alpha: NaNtoNull(this.color.alpha),
|
||||
});
|
||||
}
|
||||
/** Legacy determination of color space by option channels. */
|
||||
getLegacyChangeSpace(options) {
|
||||
let space;
|
||||
if (isNumberOrNull(options.whiteness) ||
|
||||
isNumberOrNull(options.blackness) ||
|
||||
(this.space === 'hwb' && isNumberOrNull(options.hue))) {
|
||||
space = 'hwb';
|
||||
}
|
||||
else if (isNumberOrNull(options.hue) ||
|
||||
isNumberOrNull(options.saturation) ||
|
||||
isNumberOrNull(options.lightness)) {
|
||||
space = 'hsl';
|
||||
}
|
||||
else if (isNumberOrNull(options.red) ||
|
||||
isNumberOrNull(options.green) ||
|
||||
isNumberOrNull(options.blue)) {
|
||||
space = 'rgb';
|
||||
}
|
||||
if (space !== this.space)
|
||||
emitColor4ApiChangeSpaceDeprecation();
|
||||
return space ?? this.space;
|
||||
}
|
||||
/**
|
||||
* Returns a new SassColor in the given `space` that's the result of changing
|
||||
* one or more of this color's channels.
|
||||
*/
|
||||
getChangedColor(options, space, spaceSetExplicitly) {
|
||||
const color = this.toSpace(space);
|
||||
function getChangedValue(channel) {
|
||||
if (isNumberOrNull(options[channel]))
|
||||
return options[channel];
|
||||
return color.channel(channel);
|
||||
}
|
||||
switch (space) {
|
||||
case 'hsl':
|
||||
if (spaceSetExplicitly) {
|
||||
return new SassColor({
|
||||
hue: getChangedValue('hue'),
|
||||
saturation: getChangedValue('saturation'),
|
||||
lightness: getChangedValue('lightness'),
|
||||
alpha: getChangedValue('alpha'),
|
||||
space,
|
||||
});
|
||||
}
|
||||
else {
|
||||
checkChangeDeprecations(options, ['hue', 'saturation', 'lightness']);
|
||||
return new SassColor({
|
||||
hue: options.hue ?? color.channel('hue'),
|
||||
saturation: options.saturation ?? color.channel('saturation'),
|
||||
lightness: options.lightness ?? color.channel('lightness'),
|
||||
alpha: options.alpha ?? color.channel('alpha'),
|
||||
space,
|
||||
});
|
||||
}
|
||||
case 'hwb':
|
||||
if (spaceSetExplicitly) {
|
||||
return new SassColor({
|
||||
hue: getChangedValue('hue'),
|
||||
whiteness: getChangedValue('whiteness'),
|
||||
blackness: getChangedValue('blackness'),
|
||||
alpha: getChangedValue('alpha'),
|
||||
space,
|
||||
});
|
||||
}
|
||||
else {
|
||||
checkChangeDeprecations(options, ['hue', 'whiteness', 'blackness']);
|
||||
return new SassColor({
|
||||
hue: options.hue ?? color.channel('hue'),
|
||||
whiteness: options.whiteness ?? color.channel('whiteness'),
|
||||
blackness: options.blackness ?? color.channel('blackness'),
|
||||
alpha: options.alpha ?? color.channel('alpha'),
|
||||
space,
|
||||
});
|
||||
}
|
||||
case 'rgb':
|
||||
if (spaceSetExplicitly) {
|
||||
return new SassColor({
|
||||
red: getChangedValue('red'),
|
||||
green: getChangedValue('green'),
|
||||
blue: getChangedValue('blue'),
|
||||
alpha: getChangedValue('alpha'),
|
||||
space,
|
||||
});
|
||||
}
|
||||
else {
|
||||
checkChangeDeprecations(options, ['red', 'green', 'blue']);
|
||||
return new SassColor({
|
||||
red: options.red ?? color.channel('red'),
|
||||
green: options.green ?? color.channel('green'),
|
||||
blue: options.blue ?? color.channel('blue'),
|
||||
alpha: options.alpha ?? color.channel('alpha'),
|
||||
space,
|
||||
});
|
||||
}
|
||||
case 'lab':
|
||||
case 'oklab':
|
||||
return new SassColor({
|
||||
lightness: getChangedValue('lightness'),
|
||||
a: getChangedValue('a'),
|
||||
b: getChangedValue('b'),
|
||||
alpha: getChangedValue('alpha'),
|
||||
space,
|
||||
});
|
||||
case 'lch':
|
||||
case 'oklch':
|
||||
return new SassColor({
|
||||
lightness: getChangedValue('lightness'),
|
||||
chroma: getChangedValue('chroma'),
|
||||
hue: getChangedValue('hue'),
|
||||
alpha: getChangedValue('alpha'),
|
||||
space,
|
||||
});
|
||||
case 'a98-rgb':
|
||||
case 'display-p3':
|
||||
case 'prophoto-rgb':
|
||||
case 'rec2020':
|
||||
case 'srgb':
|
||||
case 'srgb-linear':
|
||||
return new SassColor({
|
||||
red: getChangedValue('red'),
|
||||
green: getChangedValue('green'),
|
||||
blue: getChangedValue('blue'),
|
||||
alpha: getChangedValue('alpha'),
|
||||
space,
|
||||
});
|
||||
case 'xyz':
|
||||
case 'xyz-d50':
|
||||
case 'xyz-d65':
|
||||
return new SassColor({
|
||||
y: getChangedValue('y'),
|
||||
x: getChangedValue('x'),
|
||||
z: getChangedValue('z'),
|
||||
alpha: getChangedValue('alpha'),
|
||||
space,
|
||||
});
|
||||
}
|
||||
}
|
||||
change(options) {
|
||||
const spaceSetExplicitly = !!options.space;
|
||||
let space = options.space ?? this.space;
|
||||
if (this.isLegacy && !spaceSetExplicitly) {
|
||||
space = this.getLegacyChangeSpace(options);
|
||||
}
|
||||
// Validate channel values
|
||||
const keys = Object.keys(options).filter(key => key !== 'space');
|
||||
for (const channel of keys) {
|
||||
validateChannelInSpace(channel, space);
|
||||
}
|
||||
if (isNumberOrNull(options.alpha) && options.alpha !== null) {
|
||||
(0, utils_2.fuzzyAssertInRange)(options.alpha, 0, 1, 'alpha');
|
||||
}
|
||||
return this.getChangedColor(options, space, spaceSetExplicitly).toSpace(this.space);
|
||||
}
|
||||
equals(other) {
|
||||
if (!(other instanceof SassColor))
|
||||
return false;
|
||||
let coords = this.color.coords;
|
||||
let otherCoords = other.color.coords;
|
||||
if (this.isLegacy) {
|
||||
if (!other.isLegacy)
|
||||
return false;
|
||||
if (!(0, utils_2.fuzzyEquals)(this.alpha, other.alpha))
|
||||
return false;
|
||||
if (!(this.space === 'rgb' && other.space === 'rgb')) {
|
||||
coords = this.color
|
||||
.to('srgb')
|
||||
.coords.map(coordToRgb)
|
||||
.map(utils_2.fuzzyRound);
|
||||
otherCoords = other.color
|
||||
.to('srgb')
|
||||
.coords.map(coordToRgb)
|
||||
.map(utils_2.fuzzyRound);
|
||||
}
|
||||
return ((0, utils_2.fuzzyEquals)(coords[0], otherCoords[0]) &&
|
||||
(0, utils_2.fuzzyEquals)(coords[1], otherCoords[1]) &&
|
||||
(0, utils_2.fuzzyEquals)(coords[2], otherCoords[2]));
|
||||
}
|
||||
return (this.space === other.space &&
|
||||
(0, utils_2.fuzzyEquals)(coords[0], otherCoords[0]) &&
|
||||
(0, utils_2.fuzzyEquals)(coords[1], otherCoords[1]) &&
|
||||
(0, utils_2.fuzzyEquals)(coords[2], otherCoords[2]) &&
|
||||
(0, utils_2.fuzzyEquals)(this.alpha, other.alpha));
|
||||
}
|
||||
hashCode() {
|
||||
let coords = this.color.coords;
|
||||
if (this.isLegacy) {
|
||||
coords = this.color.to('srgb').coords.map(coordToRgb).map(utils_2.fuzzyRound);
|
||||
return ((0, utils_2.fuzzyHashCode)(coords[0]) ^
|
||||
(0, utils_2.fuzzyHashCode)(coords[1]) ^
|
||||
(0, utils_2.fuzzyHashCode)(coords[2]) ^
|
||||
(0, utils_2.fuzzyHashCode)(this.alpha));
|
||||
}
|
||||
return ((0, immutable_1.hash)(this.space) ^
|
||||
(0, utils_2.fuzzyHashCode)(coords[0]) ^
|
||||
(0, utils_2.fuzzyHashCode)(coords[1]) ^
|
||||
(0, utils_2.fuzzyHashCode)(coords[2]) ^
|
||||
(0, utils_2.fuzzyHashCode)(this.alpha));
|
||||
}
|
||||
toString() {
|
||||
return this.color.toString({ inGamut: false });
|
||||
}
|
||||
}
|
||||
exports.SassColor = SassColor;
|
||||
//# sourceMappingURL=color.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/value/color.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/value/color.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
74
node_modules/sass-embedded/dist/lib/src/value/function.js
generated
vendored
Normal file
74
node_modules/sass-embedded/dist/lib/src/value/function.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
"use strict";
|
||||
// Copyright 2021 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SassFunction = void 0;
|
||||
const immutable_1 = require("immutable");
|
||||
const index_1 = require("./index");
|
||||
/** A first-class SassScript function. */
|
||||
class SassFunction extends index_1.Value {
|
||||
/**
|
||||
* If this function is defined in the compiler, this is the unique ID that the
|
||||
* compiler uses to determine which function it refers to.
|
||||
*
|
||||
* This is marked as public so that the protofier can access it, but it's not
|
||||
* part of the package's public API and should not be accessed by user code.
|
||||
* It may be renamed or removed without warning in the future.
|
||||
*/
|
||||
id;
|
||||
/**
|
||||
* If this function is defined in the compiler, this is the unique context
|
||||
* that the host uses to determine which compilation this function belongs to.
|
||||
*
|
||||
* This is marked as public so that the protofier can access it, but it's not
|
||||
* part of the package's public API and should not be accessed by user code.
|
||||
* It may be renamed or removed without warning in the future.
|
||||
*/
|
||||
compileContext;
|
||||
/**
|
||||
* If this function is defined in the host, this is the signature that
|
||||
* describes how to pass arguments to it.
|
||||
*
|
||||
* This is marked as public so that the protofier can access it, but it's not
|
||||
* part of the package's public API and should not be accessed by user code.
|
||||
* It may be renamed or removed without warning in the future.
|
||||
*/
|
||||
signature;
|
||||
/**
|
||||
* If this function is defined in the host, this is the callback to run when
|
||||
* the function is invoked from a stylesheet.
|
||||
*
|
||||
* This is marked as public so that the protofier can access it, but it's not
|
||||
* part of the package's public API and should not be accessed by user code.
|
||||
* It may be renamed or removed without warning in the future.
|
||||
*/
|
||||
callback;
|
||||
constructor(idOrSignature, callbackOrCompileContext) {
|
||||
super();
|
||||
if (typeof idOrSignature === 'number' &&
|
||||
typeof callbackOrCompileContext === 'symbol') {
|
||||
this.id = idOrSignature;
|
||||
this.compileContext = callbackOrCompileContext;
|
||||
}
|
||||
else {
|
||||
this.signature = idOrSignature;
|
||||
this.callback = callbackOrCompileContext;
|
||||
}
|
||||
}
|
||||
equals(other) {
|
||||
return this.id === undefined
|
||||
? other === this
|
||||
: other instanceof SassFunction &&
|
||||
other.compileContext === this.compileContext &&
|
||||
other.id === this.id;
|
||||
}
|
||||
hashCode() {
|
||||
return this.id === undefined ? (0, immutable_1.hash)(this.signature) : (0, immutable_1.hash)(this.id);
|
||||
}
|
||||
toString() {
|
||||
return this.signature ? this.signature : `<compiler function ${this.id}>`;
|
||||
}
|
||||
}
|
||||
exports.SassFunction = SassFunction;
|
||||
//# sourceMappingURL=function.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/value/function.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/value/function.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"function.js","sourceRoot":"","sources":["../../../../lib/src/value/function.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,yCAA+B;AAG/B,mCAA8B;AAE9B,yCAAyC;AACzC,MAAa,YAAa,SAAQ,aAAK;IACrC;;;;;;;OAOG;IACM,EAAE,CAAqB;IAEhC;;;;;;;OAOG;IACM,cAAc,CAAqB;IAE5C;;;;;;;OAOG;IACM,SAAS,CAAqB;IAEvC;;;;;;;OAOG;IACM,QAAQ,CAAqC;IAItD,YACE,aAA8B,EAC9B,wBAAyD;QAEzD,KAAK,EAAE,CAAC;QAER,IACE,OAAO,aAAa,KAAK,QAAQ;YACjC,OAAO,wBAAwB,KAAK,QAAQ,EAC5C,CAAC;YACD,IAAI,CAAC,EAAE,GAAG,aAAa,CAAC;YACxB,IAAI,CAAC,cAAc,GAAG,wBAAwB,CAAC;QACjD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,SAAS,GAAG,aAAuB,CAAC;YACzC,IAAI,CAAC,QAAQ,GAAG,wBAAkD,CAAC;QACrE,CAAC;IACH,CAAC;IAED,MAAM,CAAC,KAAY;QACjB,OAAO,IAAI,CAAC,EAAE,KAAK,SAAS;YAC1B,CAAC,CAAC,KAAK,KAAK,IAAI;YAChB,CAAC,CAAC,KAAK,YAAY,YAAY;gBAC3B,KAAK,CAAC,cAAc,KAAK,IAAI,CAAC,cAAc;gBAC5C,KAAK,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;IAC7B,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,IAAA,gBAAI,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAA,gBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,sBAAsB,IAAI,CAAC,EAAE,GAAG,CAAC;IAC5E,CAAC;CACF;AA5ED,oCA4EC"}
|
||||
166
node_modules/sass-embedded/dist/lib/src/value/index.js
generated
vendored
Normal file
166
node_modules/sass-embedded/dist/lib/src/value/index.js
generated
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
"use strict";
|
||||
// Copyright 2021 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Value = void 0;
|
||||
const immutable_1 = require("immutable");
|
||||
const utils_1 = require("../utils");
|
||||
/**
|
||||
* A SassScript value.
|
||||
*
|
||||
* All SassScript values are immutable.
|
||||
*
|
||||
* Concrete values (such as `SassColor`) are implemented as subclasses and get
|
||||
* instantiated as normal JS classes.
|
||||
*
|
||||
* Untyped values can be cast to particular types using `assert*()` functions,
|
||||
* which throw user-friendly error messages if they fail.
|
||||
*
|
||||
* All values, except `false` and `null`, count as `true`.
|
||||
*
|
||||
* All values can be used as lists. Maps count as lists of pairs, while all
|
||||
* other values count as single-value lists. Empty maps are equal to empty
|
||||
* lists.
|
||||
*/
|
||||
class Value {
|
||||
/** Whether `this` counts as `true`. */
|
||||
get isTruthy() {
|
||||
return true;
|
||||
}
|
||||
/** Returns JS null if `this` is `sassNull`. Otherwise, returns `this`. */
|
||||
get realNull() {
|
||||
return this;
|
||||
}
|
||||
/** `this` as a list. */
|
||||
get asList() {
|
||||
return (0, immutable_1.List)([this]);
|
||||
}
|
||||
/** The separator for `this` as a list. */
|
||||
get separator() {
|
||||
return null;
|
||||
}
|
||||
/** Whether `this`, as a list, has brackets. */
|
||||
get hasBrackets() {
|
||||
return false;
|
||||
}
|
||||
// Subclasses can override this to change the behavior of
|
||||
// `sassIndexToListIndex`.
|
||||
get lengthAsList() {
|
||||
return 1;
|
||||
}
|
||||
/**
|
||||
* Converts `sassIndex` to a JS index into the array returned by `asList`.
|
||||
*
|
||||
* Sass indices start counting at 1, and may be negative in order to index
|
||||
* from the end of the list.
|
||||
*
|
||||
* `sassIndex` must be...
|
||||
* - a number, and
|
||||
* - an integer, and
|
||||
* - a valid index into `asList`.
|
||||
*
|
||||
* Otherwise, this throws an error.
|
||||
*
|
||||
* If `this` came from a function argument, `name` is the argument name
|
||||
* (without the `$`) and is used for error reporting.
|
||||
*/
|
||||
sassIndexToListIndex(sassIndex, name) {
|
||||
const index = sassIndex.assertNumber().assertInt();
|
||||
if (index === 0) {
|
||||
throw Error('List index may not be 0.');
|
||||
}
|
||||
if (Math.abs(index) > this.lengthAsList) {
|
||||
throw (0, utils_1.valueError)(`Invalid index ${sassIndex} for a list with ${this.lengthAsList} elements.`, name);
|
||||
}
|
||||
return index < 0 ? this.lengthAsList + index : index - 1;
|
||||
}
|
||||
/** Returns `this.asList.get(index)`. */
|
||||
get(index) {
|
||||
return index < 1 && index >= -1 ? this : undefined;
|
||||
}
|
||||
/**
|
||||
* Casts `this` to `SassBoolean`; throws if `this` isn't a boolean.
|
||||
*
|
||||
* If `this` came from a function argument, `name` is the argument name
|
||||
* (without the `$`) and is used for error reporting.
|
||||
*/
|
||||
assertBoolean(name) {
|
||||
throw (0, utils_1.valueError)(`${this} is not a boolean`, name);
|
||||
}
|
||||
/**
|
||||
* Casts `this` to `SassCalculation`; throws if `this` isn't a calculation.
|
||||
*
|
||||
* If `this` came from a function argument, `name` is the argument name
|
||||
* (without the `$`) and is used for error reporting.
|
||||
*/
|
||||
assertCalculation(name) {
|
||||
throw (0, utils_1.valueError)(`${this} is not a calculation`, name);
|
||||
}
|
||||
/**
|
||||
* Casts `this` to `SassColor`; throws if `this` isn't a color.
|
||||
*
|
||||
* If `this` came from a function argument, `name` is the argument name
|
||||
* (without the `$`) and is used for error reporting.
|
||||
*/
|
||||
assertColor(name) {
|
||||
throw (0, utils_1.valueError)(`${this} is not a color`, name);
|
||||
}
|
||||
/**
|
||||
* Casts `this` to `SassFunction`; throws if `this` isn't a function
|
||||
* reference.
|
||||
*
|
||||
* If `this` came from a function argument, `name` is the argument name
|
||||
* (without the `$`) and is used for error reporting.
|
||||
*/
|
||||
assertFunction(name) {
|
||||
throw (0, utils_1.valueError)(`${this} is not a function reference`, name);
|
||||
// TODO(awjin): Narrow the return type to SassFunction.
|
||||
}
|
||||
/**
|
||||
* Casts `this` to `SassMixin`; throws if `this` isn't a mixin
|
||||
* reference.
|
||||
*
|
||||
* If `this` came from a function argument, `name` is the argument name
|
||||
* (without the `$`) and is used for error reporting.
|
||||
*/
|
||||
assertMixin(name) {
|
||||
throw (0, utils_1.valueError)(`${this} is not a mixin reference`, name);
|
||||
}
|
||||
/**
|
||||
* Casts `this` to `SassMap`; throws if `this` isn't a map.
|
||||
*
|
||||
* If `this` came from a function argument, `name` is the argument name
|
||||
* (without the `$`) and is used for error reporting.
|
||||
*/
|
||||
assertMap(name) {
|
||||
throw (0, utils_1.valueError)(`${this} is not a map`, name);
|
||||
}
|
||||
/**
|
||||
* Returns `this` as a `SassMap` if it counts as one (including empty lists),
|
||||
* or `null` if it does not.
|
||||
*/
|
||||
tryMap() {
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Casts `this` to `SassString`; throws if `this` isn't a string.
|
||||
*
|
||||
* If `this` came from a function argument, `name` is the argument name
|
||||
* (without the `$`) and is used for error reporting.
|
||||
*/
|
||||
assertNumber(name) {
|
||||
throw (0, utils_1.valueError)(`${this} is not a number`, name);
|
||||
}
|
||||
/**
|
||||
* Casts `this` to `SassString`; throws if `this` isn't a string.
|
||||
*
|
||||
* If `this` came from a function argument, `name` is the argument name
|
||||
* (without the `$`) and is used for error reporting.
|
||||
*/
|
||||
assertString(name) {
|
||||
throw (0, utils_1.valueError)(`${this} is not a string`, name);
|
||||
}
|
||||
}
|
||||
exports.Value = Value;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/value/index.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/value/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/src/value/index.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,yCAA4C;AAQ5C,oCAAoC;AAIpC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAsB,KAAK;IACzB,uCAAuC;IACvC,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC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C,CAAC;IACrD,CAAC;IAED;;;;;OAKG;IACH,iBAAiB,CAAC,IAAa;QAC7B,MAAM,IAAA,kBAAU,EAAC,GAAG,IAAI,uBAAuB,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;IAED;;;;;OAKG;IACH,WAAW,CAAC,IAAa;QACvB,MAAM,IAAA,kBAAU,EAAC,GAAG,IAAI,iBAAiB,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;IAED;;;;;;OAMG;IACH,cAAc,CAAC,IAAa;QAC1B,MAAM,IAAA,kBAAU,EAAC,GAAG,IAAI,8BAA8B,EAAE,IAAI,CAAC,CAAC;QAC9D,uDAAuD;IACzD,CAAC;IAED;;;;;;OAMG;IACH,WAAW,CAAC,IAAa;QACvB,MAAM,IAAA,kBAAU,EAAC,GAAG,IAAI,2BAA2B,EAAE,IAAI,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;OAKG;IACH,SAAS,CAAC,IAAa;QACrB,MAAM,IAAA,kBAAU,EAAC,GAAG,IAAI,eAAe,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACH,MAAM;QACJ,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,YAAY,CAAC,IAAa;QACxB,MAAM,IAAA,kBAAU,EAAC,GAAG,IAAI,kBAAkB,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;IAED;;;;;OAKG;IACH,YAAY,CAAC,IAAa;QACxB,MAAM,IAAA,kBAAU,EAAC,GAAG,IAAI,kBAAkB,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;CAUF;AAtKD,sBAsKC"}
|
||||
101
node_modules/sass-embedded/dist/lib/src/value/list.js
generated
vendored
Normal file
101
node_modules/sass-embedded/dist/lib/src/value/list.js
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
"use strict";
|
||||
// Copyright 2021 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SassList = void 0;
|
||||
const immutable_1 = require("immutable");
|
||||
const index_1 = require("./index");
|
||||
const map_1 = require("./map");
|
||||
const utils_1 = require("../utils");
|
||||
// All empty SassList and SassMaps should have the same hashcode, so this caches
|
||||
// the value.
|
||||
const emptyListHashCode = (0, immutable_1.hash)([]);
|
||||
/** A SassScript list. */
|
||||
class SassList extends index_1.Value {
|
||||
contentsInternal;
|
||||
separatorInternal;
|
||||
hasBracketsInternal;
|
||||
constructor(contentsOrOptions, options) {
|
||||
super();
|
||||
if ((0, immutable_1.isList)(contentsOrOptions) || Array.isArray(contentsOrOptions)) {
|
||||
this.contentsInternal = (0, utils_1.asImmutableList)(contentsOrOptions);
|
||||
}
|
||||
else {
|
||||
this.contentsInternal = (0, immutable_1.List)();
|
||||
options = contentsOrOptions;
|
||||
}
|
||||
if (this.contentsInternal.size > 1 && options?.separator === null) {
|
||||
throw Error('Non-null separator required for SassList with more than one element.');
|
||||
}
|
||||
this.separatorInternal =
|
||||
options?.separator === undefined ? ',' : options.separator;
|
||||
this.hasBracketsInternal = options?.brackets ?? false;
|
||||
}
|
||||
get asList() {
|
||||
return this.contentsInternal;
|
||||
}
|
||||
/** Whether `this` has brackets. */
|
||||
get hasBrackets() {
|
||||
return this.hasBracketsInternal;
|
||||
}
|
||||
/** `this`'s list separator. */
|
||||
get separator() {
|
||||
return this.separatorInternal;
|
||||
}
|
||||
get lengthAsList() {
|
||||
return this.contentsInternal.size;
|
||||
}
|
||||
get(index) {
|
||||
return this.contentsInternal.get(index);
|
||||
}
|
||||
assertList() {
|
||||
return this;
|
||||
}
|
||||
assertMap(name) {
|
||||
if (this.contentsInternal.isEmpty())
|
||||
return new map_1.SassMap();
|
||||
throw (0, utils_1.valueError)(`${this} is not a map`, name);
|
||||
}
|
||||
/**
|
||||
* If `this` is empty, returns an empty OrderedMap.
|
||||
*
|
||||
* Otherwise, returns null.
|
||||
*/
|
||||
tryMap() {
|
||||
return this.contentsInternal.isEmpty() ? new map_1.SassMap() : null;
|
||||
}
|
||||
equals(other) {
|
||||
if ((other instanceof SassList || other instanceof map_1.SassMap) &&
|
||||
this.contentsInternal.isEmpty() &&
|
||||
other.asList.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof SassList) ||
|
||||
this.hasBrackets !== other.hasBrackets ||
|
||||
this.separator !== other.separator) {
|
||||
return false;
|
||||
}
|
||||
return this.contentsInternal.equals(other.asList);
|
||||
}
|
||||
hashCode() {
|
||||
return this.contentsInternal.isEmpty()
|
||||
? emptyListHashCode
|
||||
: this.contentsInternal.hashCode() ^
|
||||
(0, immutable_1.hash)(this.hasBrackets) ^
|
||||
(0, immutable_1.hash)(this.separator);
|
||||
}
|
||||
toString() {
|
||||
let string = '';
|
||||
if (this.hasBrackets)
|
||||
string += '[';
|
||||
string += `${this.contentsInternal.join(this.separator === ' ' || this.separator === null
|
||||
? ' '
|
||||
: `${this.separator} `)}`;
|
||||
if (this.hasBrackets)
|
||||
string += ']';
|
||||
return string;
|
||||
}
|
||||
}
|
||||
exports.SassList = SassList;
|
||||
//# sourceMappingURL=list.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/value/list.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/value/list.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../lib/src/value/list.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,yCAA6C;AAE7C,mCAA8B;AAC9B,+BAA8B;AAC9B,oCAAqD;AAKrD,gFAAgF;AAChF,aAAa;AACb,MAAM,iBAAiB,GAAG,IAAA,gBAAI,EAAC,EAAE,CAAC,CAAC;AAQnC,yBAAyB;AACzB,MAAa,QAAS,SAAQ,aAAK;IAChB,gBAAgB,CAAc;IAC9B,iBAAiB,CAAgB;IACjC,mBAAmB,CA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,CAAC,IAAI,CACrC,IAAI,CAAC,SAAS,KAAK,GAAG,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI;YAC/C,CAAC,CAAC,GAAG;YACL,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,GAAG,CACzB,EAAE,CAAC;QACJ,IAAI,IAAI,CAAC,WAAW;YAAE,MAAM,IAAI,GAAG,CAAC;QACpC,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAvHD,4BAuHC"}
|
||||
92
node_modules/sass-embedded/dist/lib/src/value/map.js
generated
vendored
Normal file
92
node_modules/sass-embedded/dist/lib/src/value/map.js
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
"use strict";
|
||||
// Copyright 2021 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SassMap = void 0;
|
||||
const immutable_1 = require("immutable");
|
||||
const index_1 = require("./index");
|
||||
const list_1 = require("./list");
|
||||
/** A SassScript map */
|
||||
class SassMap extends index_1.Value {
|
||||
contentsInternal;
|
||||
/** Returns a map that contains `contents`. */
|
||||
constructor(contents) {
|
||||
super();
|
||||
this.contentsInternal = contents ?? (0, immutable_1.OrderedMap)();
|
||||
}
|
||||
/** The separator for `this`'s contents as a list. */
|
||||
get separator() {
|
||||
return this.contentsInternal.isEmpty() ? null : ',';
|
||||
}
|
||||
/** `this`'s contents. */
|
||||
get contents() {
|
||||
return this.contentsInternal;
|
||||
}
|
||||
/**
|
||||
* Returns an immutable list of `contents`'s keys and values as two-element
|
||||
* `SassList`s.
|
||||
*/
|
||||
get asList() {
|
||||
const list = [];
|
||||
for (const entry of this.contents.entries()) {
|
||||
list.push(new list_1.SassList(entry, { separator: ' ' }));
|
||||
}
|
||||
return (0, immutable_1.List)(list);
|
||||
}
|
||||
get lengthAsList() {
|
||||
return this.contentsInternal.size;
|
||||
}
|
||||
get(indexOrKey) {
|
||||
if (indexOrKey instanceof index_1.Value) {
|
||||
return this.contentsInternal.get(indexOrKey);
|
||||
}
|
||||
else {
|
||||
const entry = this.contentsInternal
|
||||
.entrySeq()
|
||||
.get(Math.floor(indexOrKey));
|
||||
return entry ? new list_1.SassList(entry, { separator: ' ' }) : undefined;
|
||||
}
|
||||
}
|
||||
assertMap() {
|
||||
return this;
|
||||
}
|
||||
tryMap() {
|
||||
return this;
|
||||
}
|
||||
equals(other) {
|
||||
if (other instanceof list_1.SassList &&
|
||||
this.contents.size === 0 &&
|
||||
other.asList.size === 0) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof SassMap) ||
|
||||
this.contents.size !== other.contents.size) {
|
||||
return false;
|
||||
}
|
||||
for (const [key, value] of this.contents.entries()) {
|
||||
const otherValue = other.contents.get(key);
|
||||
if (otherValue === undefined || !otherValue.equals(value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
hashCode() {
|
||||
return this.contents.isEmpty()
|
||||
? new list_1.SassList().hashCode()
|
||||
: // SassMaps with the same key-value pairs are considered equal
|
||||
// regardless of key-value order, so this hash must be order
|
||||
// independent. Since OrderedMap.hashCode() encodes the key-value order,
|
||||
// we use a manual XOR accumulator instead.
|
||||
this.contents.reduce((accumulator, value, key) => accumulator ^ value.hashCode() ^ key.hashCode(), 0);
|
||||
}
|
||||
toString() {
|
||||
let string = '(';
|
||||
string += Array.from(this.contents.entries(), ([key, value]) => `${key}: ${value}`).join(', ');
|
||||
string += ')';
|
||||
return string;
|
||||
}
|
||||
}
|
||||
exports.SassMap = SassMap;
|
||||
//# sourceMappingURL=map.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/value/map.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/value/map.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"map.js","sourceRoot":"","sources":["../../../../lib/src/value/map.ts"],"names":[],"mappings":";AAAA,uEAAuE;AAC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,EAAE,CAC1B,WAAW,GAAG,KAAK,CAAC,QAAQ,EAAE,GAAG,GAAG,CAAC,QAAQ,EAAE,EACjD,CAAC,CACF,CAAC;IACR,CAAC;IAED,QAAQ;QACN,IAAI,MAAM,GAAG,GAAG,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,IAAI,CAClB,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,EACvB,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,KAAK,EAAE,CACrC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACb,MAAM,IAAI,GAAG,CAAC;QACd,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAtGD,0BAsGC"}
|
||||
50
node_modules/sass-embedded/dist/lib/src/value/mixin.js
generated
vendored
Normal file
50
node_modules/sass-embedded/dist/lib/src/value/mixin.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
// Copyright 2021 Google LLC. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SassMixin = void 0;
|
||||
const immutable_1 = require("immutable");
|
||||
const index_1 = require("./index");
|
||||
/** A first-class SassScript mixin. */
|
||||
class SassMixin extends index_1.Value {
|
||||
/**
|
||||
* This is the unique ID that the compiler uses to determine which mixin it
|
||||
* refers to.
|
||||
*
|
||||
* This is marked as public so that the protofier can access it, but it's not
|
||||
* part of the package's public API and should not be accessed by user code.
|
||||
* It may be renamed or removed without warning in the future.
|
||||
*/
|
||||
id;
|
||||
/**
|
||||
* This is the unique context that the host uses to determine which
|
||||
* compilation this mixin belongs to.
|
||||
*
|
||||
* This is marked as public so that the protofier can access it, but it's not
|
||||
* part of the package's public API and should not be accessed by user code.
|
||||
* It may be renamed or removed without warning in the future.
|
||||
*/
|
||||
compileContext;
|
||||
constructor(id, compileContext) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.compileContext = compileContext;
|
||||
}
|
||||
equals(other) {
|
||||
return (other instanceof SassMixin &&
|
||||
other.compileContext === this.compileContext &&
|
||||
other.id === this.id);
|
||||
}
|
||||
hashCode() {
|
||||
return (0, immutable_1.hash)(this.id);
|
||||
}
|
||||
toString() {
|
||||
return `<compiler mixin ${this.id}>`;
|
||||
}
|
||||
assertMixin() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
exports.SassMixin = SassMixin;
|
||||
//# sourceMappingURL=mixin.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/value/mixin.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/value/mixin.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mixin.js","sourceRoot":"","sources":["../../../../lib/src/value/mixin.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,yCAA+B;AAE/B,mCAA8B;AAE9B,sCAAsC;AACtC,MAAa,SAAU,SAAQ,aAAK;IAClC;;;;;;;OAOG;IACM,EAAE,CAAS;IAEpB;;;;;;;OAOG;IACM,cAAc,CAAS;IAEhC,YAAY,EAAU,EAAE,cAAsB;QAC5C,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAED,MAAM,CAAC,KAAY;QACjB,OAAO,CACL,KAAK,YAAY,SAAS;YAC1B,KAAK,CAAC,cAAc,KAAK,IAAI,CAAC,cAAc;YAC5C,KAAK,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CACrB,CAAC;IACJ,CAAC;IAED,QAAQ;QACN,OAAO,IAAA,gBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvB,CAAC;IAED,QAAQ;QACN,OAAO,mBAAmB,IAAI,CAAC,EAAE,GAAG,CAAC;IACvC,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA9CD,8BA8CC"}
|
||||
49
node_modules/sass-embedded/dist/lib/src/value/null.js
generated
vendored
Normal file
49
node_modules/sass-embedded/dist/lib/src/value/null.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
// Copyright 2021 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.sassNull = exports.SassNull = void 0;
|
||||
const immutable_1 = require("immutable");
|
||||
const index_1 = require("./index");
|
||||
const hashCode = (0, immutable_1.hash)(null);
|
||||
// SassScript null. Cannot be constructed; exists only as the exported
|
||||
// singleton.
|
||||
class SassNull extends index_1.Value {
|
||||
// Whether callers are allowed to construct this class. This is set to
|
||||
// `false` once the two constants are constructed so that the constructor
|
||||
// throws an error for future calls, in accordance with the legacy API.
|
||||
static constructionAllowed = true;
|
||||
constructor() {
|
||||
super();
|
||||
if (!SassNull.constructionAllowed) {
|
||||
throw ("new sass.types.Null() isn't allowed.\n" +
|
||||
'Use sass.types.Null.NULL instead.');
|
||||
}
|
||||
Object.freeze(this);
|
||||
}
|
||||
get isTruthy() {
|
||||
return false;
|
||||
}
|
||||
get realNull() {
|
||||
return null;
|
||||
}
|
||||
equals(other) {
|
||||
return this === other;
|
||||
}
|
||||
hashCode() {
|
||||
return hashCode;
|
||||
}
|
||||
toString() {
|
||||
return 'sassNull';
|
||||
}
|
||||
// Legacy API support
|
||||
static NULL;
|
||||
}
|
||||
exports.SassNull = SassNull;
|
||||
/** The singleton instance of SassScript null. */
|
||||
exports.sassNull = new SassNull();
|
||||
// Legacy API support
|
||||
SassNull.constructionAllowed = false;
|
||||
SassNull.NULL = exports.sassNull;
|
||||
//# sourceMappingURL=null.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/value/null.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/value/null.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"null.js","sourceRoot":"","sources":["../../../../lib/src/value/null.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,yCAA+B;AAE/B,mCAA8B;AAE9B,MAAM,QAAQ,GAAG,IAAA,gBAAI,EAAC,IAAI,CAAC,CAAC;AAE5B,sEAAsE;AACtE,aAAa;AACb,MAAa,QAAS,SAAQ,aAAK;IACjC,sEAAsE;IACtE,yEAAyE;IACzE,uEAAuE;IACvE,MAAM,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAElC;QACE,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,QAAQ,CAAC,mBAAmB,EAAE,CAAC;YAClC,MAAM,CACJ,wCAAwC;gBACxC,mCAAmC,CACpC,CAAC;QACJ,CAAC;QAED,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,KAAY;QACjB,OAAO,IAAI,KAAK,KAAK,CAAC;IACxB,CAAC;IAED,QAAQ;QACN,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,QAAQ;QACN,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,qBAAqB;IACrB,MAAM,CAAC,IAAI,CAAW;;AAxCxB,4BAyCC;AAED,iDAAiD;AACpC,QAAA,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;AAEvC,qBAAqB;AACrB,QAAQ,CAAC,mBAAmB,GAAG,KAAK,CAAC;AAErC,QAAQ,CAAC,IAAI,GAAG,gBAAQ,CAAC"}
|
||||
583
node_modules/sass-embedded/dist/lib/src/value/number.js
generated
vendored
Normal file
583
node_modules/sass-embedded/dist/lib/src/value/number.js
generated
vendored
Normal file
@@ -0,0 +1,583 @@
|
||||
"use strict";
|
||||
// Copyright 2021 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SassNumber = void 0;
|
||||
const immutable_1 = require("immutable");
|
||||
const utils_1 = require("../utils");
|
||||
const index_1 = require("./index");
|
||||
const utils_2 = require("./utils");
|
||||
// Conversion rates for each unit.
|
||||
const conversions = {
|
||||
// Length
|
||||
in: {
|
||||
in: 1,
|
||||
cm: 1 / 2.54,
|
||||
pc: 1 / 6,
|
||||
mm: 1 / 25.4,
|
||||
q: 1 / 101.6,
|
||||
pt: 1 / 72,
|
||||
px: 1 / 96,
|
||||
},
|
||||
cm: {
|
||||
in: 2.54,
|
||||
cm: 1,
|
||||
pc: 2.54 / 6,
|
||||
mm: 1 / 10,
|
||||
q: 1 / 40,
|
||||
pt: 2.54 / 72,
|
||||
px: 2.54 / 96,
|
||||
},
|
||||
pc: {
|
||||
in: 6,
|
||||
cm: 6 / 2.54,
|
||||
pc: 1,
|
||||
mm: 6 / 25.4,
|
||||
q: 6 / 101.6,
|
||||
pt: 1 / 12,
|
||||
px: 1 / 16,
|
||||
},
|
||||
mm: {
|
||||
in: 25.4,
|
||||
cm: 10,
|
||||
pc: 25.4 / 6,
|
||||
mm: 1,
|
||||
q: 1 / 4,
|
||||
pt: 25.4 / 72,
|
||||
px: 25.4 / 96,
|
||||
},
|
||||
q: {
|
||||
in: 101.6,
|
||||
cm: 40,
|
||||
pc: 101.6 / 6,
|
||||
mm: 4,
|
||||
q: 1,
|
||||
pt: 101.6 / 72,
|
||||
px: 101.6 / 96,
|
||||
},
|
||||
pt: {
|
||||
in: 72,
|
||||
cm: 72 / 2.54,
|
||||
pc: 12,
|
||||
mm: 72 / 25.4,
|
||||
q: 72 / 101.6,
|
||||
pt: 1,
|
||||
px: 3 / 4,
|
||||
},
|
||||
px: {
|
||||
in: 96,
|
||||
cm: 96 / 2.54,
|
||||
pc: 16,
|
||||
mm: 96 / 25.4,
|
||||
q: 96 / 101.6,
|
||||
pt: 4 / 3,
|
||||
px: 1,
|
||||
},
|
||||
// Rotation
|
||||
deg: {
|
||||
deg: 1,
|
||||
grad: 9 / 10,
|
||||
rad: 180 / Math.PI,
|
||||
turn: 360,
|
||||
},
|
||||
grad: {
|
||||
deg: 10 / 9,
|
||||
grad: 1,
|
||||
rad: 200 / Math.PI,
|
||||
turn: 400,
|
||||
},
|
||||
rad: {
|
||||
deg: Math.PI / 180,
|
||||
grad: Math.PI / 200,
|
||||
rad: 1,
|
||||
turn: 2 * Math.PI,
|
||||
},
|
||||
turn: {
|
||||
deg: 1 / 360,
|
||||
grad: 1 / 400,
|
||||
rad: 1 / (2 * Math.PI),
|
||||
turn: 1,
|
||||
},
|
||||
// Time
|
||||
s: {
|
||||
s: 1,
|
||||
ms: 1 / 1000,
|
||||
},
|
||||
ms: {
|
||||
s: 1000,
|
||||
ms: 1,
|
||||
},
|
||||
// Frequency
|
||||
Hz: { Hz: 1, kHz: 1000 },
|
||||
kHz: { Hz: 1 / 1000, kHz: 1 },
|
||||
// Pixel density
|
||||
dpi: {
|
||||
dpi: 1,
|
||||
dpcm: 2.54,
|
||||
dppx: 96,
|
||||
},
|
||||
dpcm: {
|
||||
dpi: 1 / 2.54,
|
||||
dpcm: 1,
|
||||
dppx: 96 / 2.54,
|
||||
},
|
||||
dppx: {
|
||||
dpi: 1 / 96,
|
||||
dpcm: 2.54 / 96,
|
||||
dppx: 1,
|
||||
},
|
||||
};
|
||||
// A map from each human-readable type of unit to the units that belong to that
|
||||
// type.
|
||||
const unitsByType = {
|
||||
length: ['in', 'cm', 'pc', 'mm', 'q', 'pt', 'px'],
|
||||
angle: ['deg', 'grad', 'rad', 'turn'],
|
||||
time: ['s', 'ms'],
|
||||
frequency: ['Hz', 'kHz'],
|
||||
'pixel density': ['dpi', 'dpcm', 'dppx'],
|
||||
};
|
||||
// A map from each unit to its human-readable type.
|
||||
const typesByUnit = {};
|
||||
for (const [type, units] of Object.entries(unitsByType)) {
|
||||
for (const unit of units) {
|
||||
typesByUnit[unit] = type;
|
||||
}
|
||||
}
|
||||
/** A SassScript number. */
|
||||
class SassNumber extends index_1.Value {
|
||||
valueInternal;
|
||||
numeratorUnitsInternal;
|
||||
denominatorUnitsInternal;
|
||||
constructor(value, unitOrOptions) {
|
||||
super();
|
||||
if (typeof unitOrOptions === 'string') {
|
||||
this.valueInternal = value;
|
||||
this.numeratorUnitsInternal =
|
||||
unitOrOptions === undefined ? (0, immutable_1.List)([]) : (0, immutable_1.List)([unitOrOptions]);
|
||||
this.denominatorUnitsInternal = (0, immutable_1.List)([]);
|
||||
return;
|
||||
}
|
||||
let numerators = (0, utils_1.asImmutableList)(unitOrOptions?.numeratorUnits ?? []);
|
||||
const unsimplifiedDenominators = unitOrOptions?.denominatorUnits ?? [];
|
||||
const denominators = [];
|
||||
for (const denominator of unsimplifiedDenominators) {
|
||||
let simplifiedAway = false;
|
||||
for (const [i, numerator] of numerators.entries()) {
|
||||
const factor = conversionFactor(denominator, numerator);
|
||||
if (factor === null)
|
||||
continue;
|
||||
value /= factor;
|
||||
numerators = numerators.delete(i);
|
||||
simplifiedAway = true;
|
||||
break;
|
||||
}
|
||||
if (!simplifiedAway)
|
||||
denominators.push(denominator);
|
||||
}
|
||||
this.valueInternal = value;
|
||||
this.numeratorUnitsInternal = numerators;
|
||||
this.denominatorUnitsInternal = (0, immutable_1.List)(denominators);
|
||||
}
|
||||
/** `this`'s value. */
|
||||
get value() {
|
||||
return this.valueInternal;
|
||||
}
|
||||
/** Whether `value` is an integer. */
|
||||
get isInt() {
|
||||
return (0, utils_2.fuzzyIsInt)(this.value);
|
||||
}
|
||||
/**
|
||||
* If `value` is an integer according to `isInt`, returns `value` rounded to
|
||||
* that integer.
|
||||
*
|
||||
* Otherwise, returns null.
|
||||
*/
|
||||
get asInt() {
|
||||
return (0, utils_2.fuzzyAsInt)(this.value);
|
||||
}
|
||||
/** `this`'s numerator units. */
|
||||
get numeratorUnits() {
|
||||
return this.numeratorUnitsInternal;
|
||||
}
|
||||
/** `this`'s denominator units. */
|
||||
get denominatorUnits() {
|
||||
return this.denominatorUnitsInternal;
|
||||
}
|
||||
/** Whether `this` has any units. */
|
||||
get hasUnits() {
|
||||
return !(this.numeratorUnits.isEmpty() && this.denominatorUnits.isEmpty());
|
||||
}
|
||||
assertNumber() {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* If `value` is an integer according to `isInt`, returns it as an integer.
|
||||
*
|
||||
* Otherwise, throws an error.
|
||||
*
|
||||
* If `this` came from a function argument, `name` is the argument name
|
||||
* (without the `$`) and is used for error reporting.
|
||||
*/
|
||||
assertInt(name) {
|
||||
const int = (0, utils_2.fuzzyAsInt)(this.value);
|
||||
if (int === null) {
|
||||
throw (0, utils_1.valueError)(`${this} is not an int`, name);
|
||||
}
|
||||
return int;
|
||||
}
|
||||
/**
|
||||
* If `value` is within `min` and `max`, returns `value`, or if it
|
||||
* `fuzzyEquals` `min` or `max`, returns `value` clamped to that value.
|
||||
*
|
||||
* Otherwise, throws an error.
|
||||
*
|
||||
* If `this` came from a function argument, `name` is the argument name
|
||||
* (without the `$`) and is used for error reporting.
|
||||
*/
|
||||
assertInRange(min, max, name) {
|
||||
const clamped = (0, utils_2.fuzzyInRange)(this.value, min, max);
|
||||
if (clamped === null) {
|
||||
throw (0, utils_1.valueError)(`${this} must be between ${min} and ${max}`, name);
|
||||
}
|
||||
return clamped;
|
||||
}
|
||||
/**
|
||||
* If `this` has no units, returns `this`.
|
||||
*
|
||||
* Otherwise, throws an error.
|
||||
*
|
||||
* If `this` came from a function argument, `name` is the argument name
|
||||
* (without the `$`) and is used for error reporting.
|
||||
*/
|
||||
assertNoUnits(name) {
|
||||
if (this.hasUnits) {
|
||||
throw (0, utils_1.valueError)(`Expected ${this} to have no units`, name);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* If `this` has `unit` as its only unit (and as a numerator), returns `this`.
|
||||
*
|
||||
* Otherwise, throws an error.
|
||||
*
|
||||
* If `this` came from a function argument, `name` is the argument name
|
||||
* (without the `$`) and is used for error reporting.
|
||||
*/
|
||||
assertUnit(unit, name) {
|
||||
if (!this.hasUnit(unit)) {
|
||||
throw (0, utils_1.valueError)(`Expected ${this} to have no unit ${unit}`, name);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
/** Whether `this` has `unit` as its only unit (and as a numerator). */
|
||||
hasUnit(unit) {
|
||||
return (this.denominatorUnits.isEmpty() &&
|
||||
this.numeratorUnits.size === 1 &&
|
||||
this.numeratorUnits.get(0) === unit);
|
||||
}
|
||||
/** Whether `this` is compatible with `unit`. */
|
||||
compatibleWithUnit(unit) {
|
||||
if (!this.denominatorUnits.isEmpty())
|
||||
return false;
|
||||
if (this.numeratorUnits.size > 1)
|
||||
return false;
|
||||
const numerator = this.numeratorUnits.get(0);
|
||||
return typesByUnit[numerator]
|
||||
? typesByUnit[numerator] === typesByUnit[unit]
|
||||
: numerator === unit;
|
||||
}
|
||||
/**
|
||||
* Returns a copy of `this`, converted to the units represented by
|
||||
* `newNumerators` and `newDenominators`.
|
||||
*
|
||||
* Throws an error if `this`'s units are incompatible with `newNumerators` and
|
||||
* `newDenominators`. Also throws an error if `this` is unitless and either
|
||||
* `newNumerators` or `newDenominators` are not empty, or vice-versa.
|
||||
*
|
||||
* If `this` came from a function argument, `name` is the argument name
|
||||
* (without the `$`) and is used for error reporting.
|
||||
*/
|
||||
convert(newNumerators, newDenominators, name) {
|
||||
return new SassNumber(this.convertValue(newNumerators, newDenominators, name), { numeratorUnits: newNumerators, denominatorUnits: newDenominators });
|
||||
}
|
||||
/**
|
||||
* Returns `value`, converted to the units represented by `newNumerators` and
|
||||
* `newDenominators`.
|
||||
*
|
||||
* Throws an error if `this`'s units are incompatible with `newNumerators` and
|
||||
* `newDenominators`. Also throws an error if `this` is unitless and either
|
||||
* `newNumerators` or `newDenominators` are not empty, or vice-versa.
|
||||
*
|
||||
* If `this` came from a function argument, `name` is the argument name
|
||||
* (without the `$`) and is used for error reporting.
|
||||
*/
|
||||
convertValue(newNumerators, newDenominators, name) {
|
||||
return this.convertOrCoerce({
|
||||
coerceUnitless: false,
|
||||
newNumeratorUnits: (0, utils_1.asImmutableList)(newNumerators),
|
||||
newDenominatorUnits: (0, utils_1.asImmutableList)(newDenominators),
|
||||
name,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns a copy of `this`, converted to the same units as `other`.
|
||||
*
|
||||
* Throws an error if `this`'s units are incompatible with `other`'s units, or
|
||||
* if either number is unitless but the other is not.
|
||||
*
|
||||
* If `this` came from a function argument, `name` is the argument name
|
||||
* and `otherName` is the argument name for `other` (both without the `$`).
|
||||
* They are used for error reporting.
|
||||
*/
|
||||
convertToMatch(other, name, otherName) {
|
||||
return new SassNumber(this.convertValueToMatch(other, name, otherName), {
|
||||
numeratorUnits: other.numeratorUnits,
|
||||
denominatorUnits: other.denominatorUnits,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns `value`, converted to the same units as `other`.
|
||||
*
|
||||
* Throws an error if `this`'s units are incompatible with `other`'s units, or
|
||||
* if either number is unitless but the other is not.
|
||||
*
|
||||
* If `this` came from a function argument, `name` is the argument name
|
||||
* and `otherName` is the argument name for `other` (both without the `$`).
|
||||
* They are used for error reporting.
|
||||
*/
|
||||
convertValueToMatch(other, name, otherName) {
|
||||
return this.convertOrCoerce({
|
||||
coerceUnitless: false,
|
||||
other,
|
||||
name,
|
||||
otherName,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns a copy of `this`, converted to the units represented by
|
||||
* `newNumerators` and `newDenominators`.
|
||||
*
|
||||
* Does *not* throw an error if this number is unitless and either
|
||||
* `newNumerators` or `newDenominators` are not empty, or vice-versa. Instead,
|
||||
* it treats all unitless numbers as convertible to and from all units
|
||||
* without changing the value.
|
||||
*
|
||||
* Throws an error if `this`'s units are incompatible with `newNumerators` and
|
||||
* `newDenominators`.
|
||||
*
|
||||
* If `this` came from a function argument, `name` is the argument name
|
||||
* (without the `$`) and is used for error reporting.
|
||||
*/
|
||||
coerce(newNumerators, newDenominators, name) {
|
||||
return new SassNumber(this.coerceValue(newNumerators, newDenominators, name), { numeratorUnits: newNumerators, denominatorUnits: newDenominators });
|
||||
}
|
||||
/**
|
||||
* Returns `value`, converted to the units represented by `newNumerators` and
|
||||
* `newDenominators`.
|
||||
*
|
||||
* Does *not* throw an error if this number is unitless and either
|
||||
* `newNumerators` or `newDenominators` are not empty, or vice-versa. Instead,
|
||||
* it treats all unitless numbers as convertible to and from all units
|
||||
* without changing the value.
|
||||
*
|
||||
* Throws an error if `this`'s units are incompatible with `newNumerators` and
|
||||
* `newDenominators`.
|
||||
*
|
||||
* If `this` came from a function argument, `name` is the argument name
|
||||
* (without the `$`) and is used for error reporting.
|
||||
*/
|
||||
coerceValue(newNumerators, newDenominators, name) {
|
||||
return this.convertOrCoerce({
|
||||
coerceUnitless: true,
|
||||
newNumeratorUnits: (0, utils_1.asImmutableList)(newNumerators),
|
||||
newDenominatorUnits: (0, utils_1.asImmutableList)(newDenominators),
|
||||
name,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns a copy of `this`, converted to the same units as `other`.
|
||||
*
|
||||
* Does *not* throw an error if `this` is unitless and `other` is not, or
|
||||
* vice-versa. Instead, it treats all unitless numbers as convertible to and
|
||||
* from all units without changing the value.
|
||||
*
|
||||
* Throws an error if `this`'s units are incompatible with `other`'s units.
|
||||
*
|
||||
* If `this` came from a function argument, `name` is the argument name
|
||||
* and `otherName` is the argument name for `other` (both without the `$`).
|
||||
* They are used for error reporting.
|
||||
*/
|
||||
coerceToMatch(other, name, otherName) {
|
||||
return new SassNumber(this.coerceValueToMatch(other, name, otherName), {
|
||||
numeratorUnits: other.numeratorUnits,
|
||||
denominatorUnits: other.denominatorUnits,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns `value`, converted to the same units as `other`.
|
||||
*
|
||||
* Does *not* throw an error if `this` is unitless and `other` is not, or
|
||||
* vice-versa. Instead, it treats all unitless numbers as convertible to and
|
||||
* from all units without changing the value.
|
||||
*
|
||||
* Throws an error if `this`'s units are incompatible with `other`'s units.
|
||||
*
|
||||
* If `this` came from a function argument, `name` is the argument name
|
||||
* and `otherName` is the argument name for `other` (both without the `$`).
|
||||
* They are used for error reporting.
|
||||
*/
|
||||
coerceValueToMatch(other, name, otherName) {
|
||||
return this.convertOrCoerce({
|
||||
coerceUnitless: true,
|
||||
other,
|
||||
name,
|
||||
otherName,
|
||||
});
|
||||
}
|
||||
equals(other) {
|
||||
if (!(other instanceof SassNumber))
|
||||
return false;
|
||||
try {
|
||||
return (0, utils_2.fuzzyEquals)(this.value, other.convertValueToMatch(this));
|
||||
}
|
||||
catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
hashCode() {
|
||||
const canonicalNumerators = canonicalizeUnits(this.numeratorUnits);
|
||||
const canonicalDenominators = canonicalizeUnits(this.denominatorUnits);
|
||||
const canonicalValue = this.convertValue(canonicalNumerators, canonicalDenominators);
|
||||
return ((0, utils_2.fuzzyHashCode)(canonicalValue) ^
|
||||
(0, immutable_1.hash)(canonicalNumerators) ^
|
||||
(0, immutable_1.hash)(canonicalDenominators));
|
||||
}
|
||||
toString() {
|
||||
return `${this.value}${unitString(this.numeratorUnits, this.denominatorUnits)}`;
|
||||
}
|
||||
// Returns the value of converting `number` to new units.
|
||||
//
|
||||
// The units may be specified as lists of units (`newNumeratorUnits` and
|
||||
// `newDenominatorUnits`), or by providng a SassNumber `other` that contains the
|
||||
// desired units.
|
||||
//
|
||||
// Throws an error if `number` is not compatible with the new units. Coercing a
|
||||
// unitful number to unitless (or vice-versa) throws an error unless
|
||||
// specifically enabled with `coerceUnitless`.
|
||||
convertOrCoerce(params) {
|
||||
const newNumerators = 'other' in params
|
||||
? params.other.numeratorUnits
|
||||
: params.newNumeratorUnits;
|
||||
const newDenominators = 'other' in params
|
||||
? params.other.denominatorUnits
|
||||
: params.newDenominatorUnits;
|
||||
const compatibilityError = () => {
|
||||
if ('other' in params) {
|
||||
let message = `${this} and`;
|
||||
if (params.otherName) {
|
||||
message += ` $${params.otherName}:`;
|
||||
}
|
||||
message += ` ${params.other} have incompatible units`;
|
||||
if (!this.hasUnits || !otherHasUnits) {
|
||||
message += " (one has units and the other doesn't)";
|
||||
}
|
||||
return (0, utils_1.valueError)(message, params.name);
|
||||
}
|
||||
if (!otherHasUnits) {
|
||||
return (0, utils_1.valueError)(`Expected ${this} to have no units.`, params.name);
|
||||
}
|
||||
// For single numerators, throw a detailed error with info about which unit
|
||||
// types would have been acceptable.
|
||||
if (newNumerators.size === 1 && newDenominators.isEmpty()) {
|
||||
const type = typesByUnit[newNumerators.get(0)];
|
||||
if (type) {
|
||||
return (0, utils_1.valueError)(`Expected ${this} to have a single ${type} unit (${unitsByType[type].join(', ')}).`, params.name);
|
||||
}
|
||||
}
|
||||
const unitSize = newNumerators.size + newDenominators.size;
|
||||
return (0, utils_1.valueError)(`Expected $this to have ${unitSize === 0
|
||||
? 'no units'
|
||||
: `unit${unitSize > 1 ? 's' : ''} ${unitString(newNumerators, newDenominators)}`}.`, params.name);
|
||||
};
|
||||
const otherHasUnits = !newNumerators.isEmpty() || !newDenominators.isEmpty();
|
||||
if ((this.hasUnits && !otherHasUnits) ||
|
||||
(!this.hasUnits && otherHasUnits)) {
|
||||
if (params.coerceUnitless)
|
||||
return this.value;
|
||||
throw compatibilityError();
|
||||
}
|
||||
if (this.numeratorUnits.equals(newNumerators) &&
|
||||
this.denominatorUnits.equals(newDenominators)) {
|
||||
return this.value;
|
||||
}
|
||||
let value = this.value;
|
||||
let oldNumerators = this.numeratorUnits;
|
||||
for (const newNumerator of newNumerators) {
|
||||
const idx = oldNumerators.findIndex(oldNumerator => {
|
||||
const factor = conversionFactor(oldNumerator, newNumerator);
|
||||
if (factor === null)
|
||||
return false;
|
||||
value *= factor;
|
||||
return true;
|
||||
});
|
||||
if (idx < 0)
|
||||
throw compatibilityError();
|
||||
oldNumerators = oldNumerators.delete(idx);
|
||||
}
|
||||
let oldDenominators = this.denominatorUnits;
|
||||
for (const newDenominator of newDenominators) {
|
||||
const idx = oldDenominators.findIndex(oldDenominator => {
|
||||
const factor = conversionFactor(oldDenominator, newDenominator);
|
||||
if (factor === null)
|
||||
return false;
|
||||
value /= factor;
|
||||
return true;
|
||||
});
|
||||
if (idx < 0)
|
||||
throw compatibilityError();
|
||||
oldDenominators = oldDenominators.delete(idx);
|
||||
}
|
||||
if (!oldNumerators.isEmpty() || !oldDenominators.isEmpty()) {
|
||||
throw compatibilityError();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
exports.SassNumber = SassNumber;
|
||||
// Returns the conversion factor needed to convert from `fromUnit` to `toUnit`.
|
||||
// Returns null if no such factor exists.
|
||||
function conversionFactor(fromUnit, toUnit) {
|
||||
if (fromUnit === toUnit)
|
||||
return 1;
|
||||
const factors = conversions[toUnit];
|
||||
if (!factors)
|
||||
return null;
|
||||
return factors[fromUnit] ?? null;
|
||||
}
|
||||
// Returns a human-readable string representation of `numerators` and
|
||||
// `denominators`.
|
||||
function unitString(numerators, denominators) {
|
||||
if (numerators.isEmpty() && denominators.isEmpty()) {
|
||||
return '';
|
||||
}
|
||||
if (denominators.isEmpty()) {
|
||||
return numerators.join('*');
|
||||
}
|
||||
if (numerators.isEmpty()) {
|
||||
return denominators.size === 1
|
||||
? `${denominators.get(0)}^-1`
|
||||
: `(${denominators.join('*')})^-1`;
|
||||
}
|
||||
return `${numerators.join('*')}/${denominators.join('*')}`;
|
||||
}
|
||||
// Converts the `units` list into an equivalent canonical list.
|
||||
function canonicalizeUnits(units) {
|
||||
return units
|
||||
.map(unit => {
|
||||
const type = typesByUnit[unit];
|
||||
return type ? unitsByType[type][0] : unit;
|
||||
})
|
||||
.sort();
|
||||
}
|
||||
//# sourceMappingURL=number.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/value/number.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/value/number.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
118
node_modules/sass-embedded/dist/lib/src/value/string.js
generated
vendored
Normal file
118
node_modules/sass-embedded/dist/lib/src/value/string.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
"use strict";
|
||||
// Copyright 2021 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SassString = void 0;
|
||||
const immutable_1 = require("immutable");
|
||||
const index_1 = require("./index");
|
||||
const utils_1 = require("../utils");
|
||||
/** A SassScript string. */
|
||||
class SassString extends index_1.Value {
|
||||
textInternal;
|
||||
hasQuotesInternal;
|
||||
constructor(textOrOptions, options) {
|
||||
super();
|
||||
if (typeof textOrOptions === 'string') {
|
||||
this.textInternal = textOrOptions;
|
||||
this.hasQuotesInternal = options?.quotes ?? true;
|
||||
}
|
||||
else {
|
||||
this.textInternal = '';
|
||||
this.hasQuotesInternal = textOrOptions?.quotes ?? true;
|
||||
}
|
||||
}
|
||||
/** Creates an empty string, optionally with quotes. */
|
||||
static empty(options) {
|
||||
return options === undefined || options?.quotes
|
||||
? emptyQuoted
|
||||
: emptyUnquoted;
|
||||
}
|
||||
/** `this`'s text. */
|
||||
get text() {
|
||||
return this.textInternal;
|
||||
}
|
||||
/** Whether `this` has quotes. */
|
||||
get hasQuotes() {
|
||||
return this.hasQuotesInternal;
|
||||
}
|
||||
assertString() {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Sass's notion of `this`'s length.
|
||||
*
|
||||
* Sass treats strings as a series of Unicode code points while JS treats them
|
||||
* as a series of UTF-16 code units. For example, the character U+1F60A,
|
||||
* Smiling Face With Smiling Eyes, is a single Unicode code point but is
|
||||
* represented in UTF-16 as two code units (`0xD83D` and `0xDE0A`). So in
|
||||
* JS, `"n😊b".length` returns `4`, whereas in Sass `string.length("n😊b")`
|
||||
* returns `3`.
|
||||
*/
|
||||
get sassLength() {
|
||||
let length = 0;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
for (const codepoint of this.text) {
|
||||
length++;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
/**
|
||||
* Converts `sassIndex` to a JS index into `text`.
|
||||
*
|
||||
* Sass indices are one-based, while JS indices are zero-based. Sass
|
||||
* indices may also be negative in order to index from the end of the string.
|
||||
*
|
||||
* In addition, Sass indices refer to Unicode code points while JS string
|
||||
* indices refer to UTF-16 code units. For example, the character U+1F60A,
|
||||
* Smiling Face With Smiling Eyes, is a single Unicode code point but is
|
||||
* represented in UTF-16 as two code units (`0xD83D` and `0xDE0A`). So in
|
||||
* JS, `"n😊b".charAt(1)` returns `0xD83D`, whereas in Sass
|
||||
* `string.slice("n😊b", 1, 1)` returns `"😊"`.
|
||||
*
|
||||
* This function converts Sass's code point indices to JS's code unit
|
||||
* indices. This means it's O(n) in the length of `text`.
|
||||
*
|
||||
* Throws an error `sassIndex` isn't a number, if that number isn't an
|
||||
* integer, or if that integer isn't a valid index for this string.
|
||||
*
|
||||
* If `sassIndex` came from a function argument, `name` is the argument name
|
||||
* (without the `$`) and is used for error reporting.
|
||||
*/
|
||||
sassIndexToStringIndex(sassIndex, name) {
|
||||
let sassIdx = sassIndex.assertNumber().assertInt();
|
||||
if (sassIdx === 0) {
|
||||
throw (0, utils_1.valueError)('String index may not be 0', name);
|
||||
}
|
||||
const sassLength = this.sassLength;
|
||||
if (Math.abs(sassIdx) > sassLength) {
|
||||
throw (0, utils_1.valueError)(`Invalid index ${sassIdx} for a string with ${sassLength} characters`, name);
|
||||
}
|
||||
if (sassIdx < 0)
|
||||
sassIdx += sassLength + 1;
|
||||
let pointer = 1;
|
||||
let idx = 0;
|
||||
for (const codePoint of this.text) {
|
||||
if (pointer === sassIdx)
|
||||
break;
|
||||
idx += codePoint.length;
|
||||
pointer++;
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
equals(other) {
|
||||
return other instanceof SassString && this.text === other.text;
|
||||
}
|
||||
hashCode() {
|
||||
return (0, immutable_1.hash)(this.text);
|
||||
}
|
||||
toString() {
|
||||
return this.hasQuotes ? `"${this.text}"` : this.text;
|
||||
}
|
||||
}
|
||||
exports.SassString = SassString;
|
||||
// A quoted empty string returned by `SassString.empty()`.
|
||||
const emptyQuoted = new SassString('', { quotes: true });
|
||||
// An unquoted empty string returned by `SassString.empty()`.
|
||||
const emptyUnquoted = new SassString('', { quotes: false });
|
||||
//# sourceMappingURL=string.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/value/string.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/value/string.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../../lib/src/value/string.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,yCAA+B;AAE/B,mCAA8B;AAC9B,oCAAoC;AAEpC,2BAA2B;AAC3B,MAAa,UAAW,SAAQ,aAAK;IAClB,YAAY,CAAS;IACrB,iBAAiB,CAAU;IAK5C,YACE,aAA2C,EAC3C,OAA4B;QAE5B,KAAK,EAAE,CAAC;QAER,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE,CAAC;YACtC,IAAI,CAAC,YAAY,GAAG,aAAa,CAAC;YAClC,IAAI,CAAC,iBAAiB,GAAG,OAAO,EAAE,MAAM,IAAI,IAAI,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;YACvB,IAAI,CAAC,iBAAiB,GAAG,aAAa,EAAE,MAAM,IAAI,IAAI,CAAC;QACzD,CAAC;IACH,CAAC;IAED,uDAAuD;IACvD,MAAM,CAAC,KAAK,CAAC,OAAiD;QAC5D,OAAO,OAAO,KAAK,SAAS,IAAI,OAAO,EAAE,MAAM;YAC7C,CAAC,CAAC,WAAW;YACb,CA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xB,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAED,MAAM,CAAC,KAAY;QACjB,OAAO,KAAK,YAAY,UAAU,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC;IACjE,CAAC;IAED,QAAQ;QACN,OAAO,IAAA,gBAAI,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IACvD,CAAC;CACF;AAxHD,gCAwHC;AAED,0DAA0D;AAC1D,MAAM,WAAW,GAAG,IAAI,UAAU,CAAC,EAAE,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC;AAEvD,6DAA6D;AAC7D,MAAM,aAAa,GAAG,IAAI,UAAU,CAAC,EAAE,EAAE,EAAC,MAAM,EAAE,KAAK,EAAC,CAAC,CAAC"}
|
||||
120
node_modules/sass-embedded/dist/lib/src/value/utils.js
generated
vendored
Normal file
120
node_modules/sass-embedded/dist/lib/src/value/utils.js
generated
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
"use strict";
|
||||
// Copyright 2021 Google Inc. Use of this source code is governed by an
|
||||
// MIT-style license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.precision = void 0;
|
||||
exports.fuzzyEquals = fuzzyEquals;
|
||||
exports.fuzzyHashCode = fuzzyHashCode;
|
||||
exports.fuzzyLessThan = fuzzyLessThan;
|
||||
exports.fuzzyLessThanOrEquals = fuzzyLessThanOrEquals;
|
||||
exports.fuzzyGreaterThan = fuzzyGreaterThan;
|
||||
exports.fuzzyGreaterThanOrEquals = fuzzyGreaterThanOrEquals;
|
||||
exports.fuzzyIsInt = fuzzyIsInt;
|
||||
exports.fuzzyAsInt = fuzzyAsInt;
|
||||
exports.fuzzyRound = fuzzyRound;
|
||||
exports.fuzzyInRange = fuzzyInRange;
|
||||
exports.fuzzyAssertInRange = fuzzyAssertInRange;
|
||||
exports.positiveMod = positiveMod;
|
||||
const immutable_1 = require("immutable");
|
||||
const utils_1 = require("../utils");
|
||||
/** The precision of Sass numbers. */
|
||||
exports.precision = 10;
|
||||
// The max distance two Sass numbers can be from each another before they're
|
||||
// considered different.
|
||||
//
|
||||
// Uses ** instead of Math.pow() for constant folding.
|
||||
const epsilon = 10 ** (-exports.precision - 1);
|
||||
/** Whether `num1` and `num2` are equal within `epsilon`. */
|
||||
function fuzzyEquals(num1, num2) {
|
||||
return Math.abs(num1 - num2) < epsilon;
|
||||
}
|
||||
/**
|
||||
* Returns a hash code for `num`.
|
||||
*
|
||||
* Two numbers that `fuzzyEquals` each other must have the same hash code.
|
||||
*/
|
||||
function fuzzyHashCode(num) {
|
||||
return !isFinite(num) || isNaN(num)
|
||||
? (0, immutable_1.hash)(num)
|
||||
: (0, immutable_1.hash)(Math.round(num / epsilon));
|
||||
}
|
||||
/** Whether `num1` < `num2`, within `epsilon`. */
|
||||
function fuzzyLessThan(num1, num2) {
|
||||
return num1 < num2 && !fuzzyEquals(num1, num2);
|
||||
}
|
||||
/** Whether `num1` <= `num2`, within `epsilon`. */
|
||||
function fuzzyLessThanOrEquals(num1, num2) {
|
||||
return num1 < num2 || fuzzyEquals(num1, num2);
|
||||
}
|
||||
/** Whether `num1` > `num2`, within `epsilon`. */
|
||||
function fuzzyGreaterThan(num1, num2) {
|
||||
return num1 > num2 && !fuzzyEquals(num1, num2);
|
||||
}
|
||||
/** Whether `num1` >= `num2`, within `epsilon`. */
|
||||
function fuzzyGreaterThanOrEquals(num1, num2) {
|
||||
return num1 > num2 || fuzzyEquals(num1, num2);
|
||||
}
|
||||
/** Whether `num` `fuzzyEquals` an integer. */
|
||||
function fuzzyIsInt(num) {
|
||||
return !isFinite(num) || isNaN(num)
|
||||
? false
|
||||
: // Check against 0.5 rather than 0.0 so that we catch numbers that are
|
||||
// both very slightly above an integer, and very slightly below.
|
||||
fuzzyEquals(Math.abs(num - 0.5) % 1, 0.5);
|
||||
}
|
||||
/**
|
||||
* If `num` `fuzzyIsInt`, returns it as an integer. Otherwise, returns `null`.
|
||||
*/
|
||||
function fuzzyAsInt(num) {
|
||||
return fuzzyIsInt(num) ? Math.round(num) : null;
|
||||
}
|
||||
/**
|
||||
* Rounds `num` to the nearest integer.
|
||||
*
|
||||
* If `num` `fuzzyEquals` `x.5`, rounds away from zero.
|
||||
*/
|
||||
function fuzzyRound(num) {
|
||||
if (num > 0) {
|
||||
return fuzzyLessThan(num % 1, 0.5) ? Math.floor(num) : Math.ceil(num);
|
||||
}
|
||||
else {
|
||||
return fuzzyGreaterThan(num % 1, -0.5) ? Math.ceil(num) : Math.floor(num);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns `num` if it's within `min` and `max`, or `null` if it's not.
|
||||
*
|
||||
* If `num` `fuzzyEquals` `min` or `max`, it gets clamped to that value.
|
||||
*/
|
||||
function fuzzyInRange(num, min, max) {
|
||||
if (fuzzyEquals(num, min))
|
||||
return min;
|
||||
if (fuzzyEquals(num, max))
|
||||
return max;
|
||||
if (num > min && num < max)
|
||||
return num;
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Returns `num` if it's within `min` and `max`. Otherwise, throws an error.
|
||||
*
|
||||
* If `num` `fuzzyEquals` `min` or `max`, it gets clamped to that value.
|
||||
*
|
||||
* If `name` is provided, it is used as the parameter name for error reporting.
|
||||
*/
|
||||
function fuzzyAssertInRange(num, min, max, name) {
|
||||
if (fuzzyEquals(num, min))
|
||||
return min;
|
||||
if (fuzzyEquals(num, max))
|
||||
return max;
|
||||
if (num > min && num < max)
|
||||
return num;
|
||||
throw (0, utils_1.valueError)(`${num} must be between ${min} and ${max}`, name);
|
||||
}
|
||||
/** Returns `dividend % modulus`, but always in the range `[0, modulus)`. */
|
||||
function positiveMod(dividend, modulus) {
|
||||
const result = dividend % modulus;
|
||||
return result < 0 ? result + modulus : result;
|
||||
}
|
||||
//# sourceMappingURL=utils.js.map
|
||||
1
node_modules/sass-embedded/dist/lib/src/value/utils.js.map
generated
vendored
Normal file
1
node_modules/sass-embedded/dist/lib/src/value/utils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../lib/src/value/utils.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAgBvC,kCAEC;AAOD,sCAIC;AAGD,sCAEC;AAGD,sDAEC;AAGD,4CAEC;AAGD,4DAEC;AAGD,gCAMC;AAKD,gCAEC;AAOD,gCAMC;AAOD,oCASC;AASD,gDAUC;AAGD,kCAGC;AArHD,yCAA+B;AAE/B,oCAAoC;AAEpC,qCAAqC;AACxB,QAAA,SAAS,GAAG,EAAE,CAAC;AAE5B,4EAA4E;AAC5E,wBAAwB;AACxB,EAAE;AACF,sDAAsD;AACtD,MAAM,OAAO,GAAG,EAAE,IAAI,CAAC,CAAC,iBAAS,GAAG,CAAC,CAAC,CAAC;AAEvC,4DAA4D;AAC5D,SAAgB,WAAW,CAAC,IAAY,EAAE,IAAY;IACpD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAAC,GAAW;IACvC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC;QACjC,CAAC,CAAC,IAAA,gBAAI,EAAC,GAAG,CAAC;QACX,CAAC,CAAC,IAAA,gBAAI,EAAC,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC;AACtC,CAAC;AAED,iDAAiD;AACjD,SAAgB,aAAa,CAAC,IAAY,EAAE,IAAY;IACtD,OAAO,IAAI,GAAG,I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/sass-embedded/dist/lib/src/vendor/deprecations.js
generated
vendored
Normal file
195
node_modules/sass-embedded/dist/lib/src/vendor/deprecations.js
generated
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.deprecations = void 0;
|
||||
const version_1 = require("../version");
|
||||
exports.deprecations = {
|
||||
'call-string': {
|
||||
id: 'call-string',
|
||||
description: 'Passing a string directly to meta.call().',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(0, 0, 0),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
elseif: {
|
||||
id: 'elseif',
|
||||
description: '@elseif.',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 3, 2),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
'moz-document': {
|
||||
id: 'moz-document',
|
||||
description: '@-moz-document.',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 7, 2),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
'relative-canonical': {
|
||||
id: 'relative-canonical',
|
||||
description: 'Imports using relative canonical URLs.',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 14, 2),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
'new-global': {
|
||||
id: 'new-global',
|
||||
description: 'Declaring new variables with !global.',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 17, 2),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
'color-module-compat': {
|
||||
id: 'color-module-compat',
|
||||
description: 'Using color module functions in place of plain CSS functions.',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 23, 0),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
'slash-div': {
|
||||
id: 'slash-div',
|
||||
description: '/ operator for division.',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 33, 0),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
'bogus-combinators': {
|
||||
id: 'bogus-combinators',
|
||||
description: 'Leading, trailing, and repeated combinators.',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 54, 0),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
'strict-unary': {
|
||||
id: 'strict-unary',
|
||||
description: 'Ambiguous + and - operators.',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 55, 0),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
'function-units': {
|
||||
id: 'function-units',
|
||||
description: 'Passing invalid units to built-in functions.',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 56, 0),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
'duplicate-var-flags': {
|
||||
id: 'duplicate-var-flags',
|
||||
description: 'Using !default or !global multiple times for one variable.',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 62, 0),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
'null-alpha': {
|
||||
id: 'null-alpha',
|
||||
description: 'Passing null as alpha in the $PLATFORM API.',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 62, 3),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
'abs-percent': {
|
||||
id: 'abs-percent',
|
||||
description: 'Passing percentages to the Sass abs() function.',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 65, 0),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
'fs-importer-cwd': {
|
||||
id: 'fs-importer-cwd',
|
||||
description: 'Using the current working directory as an implicit load path.',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 73, 0),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
'css-function-mixin': {
|
||||
id: 'css-function-mixin',
|
||||
description: 'Function and mixin names beginning with --.',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 76, 0),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
'mixed-decls': {
|
||||
id: 'mixed-decls',
|
||||
description: 'Declarations after or between nested rules.',
|
||||
status: 'obsolete',
|
||||
deprecatedIn: new version_1.Version(1, 77, 7),
|
||||
obsoleteIn: new version_1.Version(1, 92, 0),
|
||||
},
|
||||
'feature-exists': {
|
||||
id: 'feature-exists',
|
||||
description: 'meta.feature-exists',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 78, 0),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
'color-4-api': {
|
||||
id: 'color-4-api',
|
||||
description: 'Certain uses of built-in sass:color functions.',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 79, 0),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
'color-functions': {
|
||||
id: 'color-functions',
|
||||
description: 'Using global color functions instead of sass:color.',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 79, 0),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
'legacy-js-api': {
|
||||
id: 'legacy-js-api',
|
||||
description: 'Legacy JS API.',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 79, 0),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
import: {
|
||||
id: 'import',
|
||||
description: '@import rules.',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 80, 0),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
'global-builtin': {
|
||||
id: 'global-builtin',
|
||||
description: 'Global built-in functions that are available in sass: modules.',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 80, 0),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
'type-function': {
|
||||
id: 'type-function',
|
||||
description: 'Functions named "type".',
|
||||
status: 'obsolete',
|
||||
deprecatedIn: new version_1.Version(1, 86, 0),
|
||||
obsoleteIn: new version_1.Version(1, 92, 0),
|
||||
},
|
||||
'compile-string-relative-url': {
|
||||
id: 'compile-string-relative-url',
|
||||
description: 'Passing a relative url to compileString().',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 88, 0),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
'misplaced-rest': {
|
||||
id: 'misplaced-rest',
|
||||
description: 'A rest parameter before a positional or named parameter.',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 91, 0),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
'with-private': {
|
||||
id: 'with-private',
|
||||
description: 'Configuring private variables in @use, @forward, or load-css().',
|
||||
status: 'active',
|
||||
deprecatedIn: new version_1.Version(1, 92, 0),
|
||||
obsoleteIn: null,
|
||||
},
|
||||
'user-authored': {
|
||||
id: 'user-authored',
|
||||
status: 'user',
|
||||
deprecatedIn: null,
|
||||
obsoleteIn: null,
|
||||
},
|
||||
};
|
||||
//# sourceMappingURL=deprecations.js.map
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user