sass-embedded 1.0.0-beta.8 → 1.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/lib/index.js +14 -6
  3. package/dist/lib/index.js.map +1 -1
  4. package/dist/lib/src/compile.js +1 -1
  5. package/dist/lib/src/compile.js.map +1 -1
  6. package/dist/lib/src/legacy/importer.js +186 -0
  7. package/dist/lib/src/legacy/importer.js.map +1 -0
  8. package/dist/lib/src/legacy/index.js +261 -0
  9. package/dist/lib/src/legacy/index.js.map +1 -0
  10. package/dist/lib/src/legacy/resolve-path.js +101 -0
  11. package/dist/lib/src/legacy/resolve-path.js.map +1 -0
  12. package/dist/lib/src/legacy/value/base.js +17 -0
  13. package/dist/lib/src/legacy/value/base.js.map +1 -0
  14. package/dist/lib/src/legacy/value/color.js +64 -0
  15. package/dist/lib/src/legacy/value/color.js.map +1 -0
  16. package/dist/lib/src/legacy/value/index.js +23 -0
  17. package/dist/lib/src/legacy/value/index.js.map +1 -0
  18. package/dist/lib/src/legacy/value/list.js +50 -0
  19. package/dist/lib/src/legacy/value/list.js.map +1 -0
  20. package/dist/lib/src/legacy/value/map.js +74 -0
  21. package/dist/lib/src/legacy/value/map.js.map +1 -0
  22. package/dist/lib/src/legacy/value/number.js +60 -0
  23. package/dist/lib/src/legacy/value/number.js.map +1 -0
  24. package/dist/lib/src/legacy/value/string.js +27 -0
  25. package/dist/lib/src/legacy/value/string.js.map +1 -0
  26. package/dist/lib/src/legacy/value/wrap.js +83 -0
  27. package/dist/lib/src/legacy/value/wrap.js.map +1 -0
  28. package/dist/lib/src/utils.js +14 -1
  29. package/dist/lib/src/utils.js.map +1 -1
  30. package/dist/lib/src/value/boolean.js +17 -1
  31. package/dist/lib/src/value/boolean.js.map +1 -1
  32. package/dist/lib/src/value/null.js +13 -1
  33. package/dist/lib/src/value/null.js.map +1 -1
  34. package/dist/package.json +2 -2
  35. package/dist/tool/utils.js +1 -1
  36. package/dist/tool/utils.js.map +1 -1
  37. package/dist/types/index.d.ts +5 -1
  38. package/dist/types/legacy/function.d.ts +63 -7
  39. package/dist/types/legacy/plugin_this.d.ts +4 -4
  40. package/dist/types/options.d.ts +10 -0
  41. package/package.json +2 -2
  42. package/dist/lib/src/legacy.js +0 -133
  43. package/dist/lib/src/legacy.js.map +0 -1
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ // Copyright 2022 Google LLC. Use of this source code is governed by an
3
+ // MIT-style license that can be found in the LICENSE file or at
4
+ // https://opensource.org/licenses/MIT.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.resolvePath = void 0;
7
+ const fs = require("fs");
8
+ const p = require("path");
9
+ /**
10
+ * Resolves a path using the same logic as the filesystem importer.
11
+ *
12
+ * This tries to fill in extensions and partial prefixes and check for a
13
+ * directory default. If no file can be found, it returns `null`.
14
+ */
15
+ function resolvePath(path, fromImport) {
16
+ var _a, _b, _c;
17
+ const extension = p.extname(path);
18
+ if (extension === '.sass' || extension === '.scss' || extension === '.css') {
19
+ return ((_a = (fromImport
20
+ ? exactlyOne(tryPath(`${withoutExtension(path)}.import${extension}`))
21
+ : null)) !== null && _a !== void 0 ? _a : exactlyOne(tryPath(path)));
22
+ }
23
+ return ((_c = (_b = (fromImport ? exactlyOne(tryPathWithExtensions(`${path}.import`)) : null)) !== null && _b !== void 0 ? _b : exactlyOne(tryPathWithExtensions(path))) !== null && _c !== void 0 ? _c : tryPathAsDirectory(path, fromImport));
24
+ }
25
+ exports.resolvePath = resolvePath;
26
+ // Like `tryPath`, but checks `.sass`, `.scss`, and `.css` extensions.
27
+ function tryPathWithExtensions(path) {
28
+ const result = [...tryPath(path + '.sass'), ...tryPath(path + '.scss')];
29
+ return result.length > 0 ? result : tryPath(path + '.css');
30
+ }
31
+ // Returns the `path` and/or the partial with the same name, if either or both
32
+ // exists. If neither exists, returns an empty list.
33
+ function tryPath(path) {
34
+ const partial = p.join(p.dirname(path), `_${p.basename(path)}`);
35
+ const result = [];
36
+ if (fileExists(partial))
37
+ result.push(partial);
38
+ if (fileExists(path))
39
+ result.push(path);
40
+ return result;
41
+ }
42
+ // Returns the resolved index file for `path` if `path` is a directory and the
43
+ // index file exists. Otherwise, returns `null`.
44
+ function tryPathAsDirectory(path, fromImport) {
45
+ var _a;
46
+ if (!dirExists(path))
47
+ return null;
48
+ return ((_a = (fromImport
49
+ ? exactlyOne(tryPathWithExtensions(p.join(path, 'index.import')))
50
+ : null)) !== null && _a !== void 0 ? _a : exactlyOne(tryPathWithExtensions(p.join(path, 'index'))));
51
+ }
52
+ // If `paths` contains exactly one path, returns that path. If it contains no
53
+ // paths, returns `null`. If it contains more than one, throws an exception.
54
+ function exactlyOne(paths) {
55
+ if (paths.length === 0)
56
+ return null;
57
+ if (paths.length === 1)
58
+ return paths[0];
59
+ throw new Error("It's not clear which file to import. Found:\n" +
60
+ paths.map(path => ' ' + path).join('\n'));
61
+ }
62
+ // Returns whether or not a file (not a directory) exists at `path`.
63
+ function fileExists(path) {
64
+ // `existsSync()` is faster than `statSync()`, but it doesn't clarify whether
65
+ // the entity in question is a file or a directory. Since false negatives are
66
+ // much more common than false positives, it works out in our favor to check
67
+ // this first.
68
+ if (!fs.existsSync(path))
69
+ return false;
70
+ try {
71
+ return fs.statSync(path).isFile();
72
+ }
73
+ catch (error) {
74
+ if (error.code === 'ENOENT')
75
+ return false;
76
+ throw error;
77
+ }
78
+ }
79
+ // Returns whether or not a directory (not a file) exists at `path`.
80
+ function dirExists(path) {
81
+ // `existsSync()` is faster than `statSync()`, but it doesn't clarify whether
82
+ // the entity in question is a file or a directory. Since false negatives are
83
+ // much more common than false positives, it works out in our favor to check
84
+ // this first.
85
+ if (!fs.existsSync(path))
86
+ return false;
87
+ try {
88
+ return fs.statSync(path).isDirectory();
89
+ }
90
+ catch (error) {
91
+ if (error.code === 'ENOENT')
92
+ return false;
93
+ throw error;
94
+ }
95
+ }
96
+ // Returns `path` without its file extension.
97
+ function withoutExtension(path) {
98
+ const extension = p.extname(path);
99
+ return path.substring(0, path.length - extension.length);
100
+ }
101
+ //# sourceMappingURL=resolve-path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-path.js","sourceRoot":"","sources":["../../../../lib/src/legacy/resolve-path.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,yBAAyB;AACzB,0BAA0B;AAE1B;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,IAAY,EAAE,UAAmB;;IAC3D,MAAM,SAAS,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,SAAS,KAAK,OAAO,IAAI,SAAS,KAAK,OAAO,IAAI,SAAS,KAAK,MAAM,EAAE;QAC1E,OAAO,CACL,MAAA,CAAC,UAAU;YACT,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,UAAU,SAAS,EAAE,CAAC,CAAC;YACrE,CAAC,CAAC,IAAI,CAAC,mCAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CACvC,CAAC;KACH;IAED,OAAO,CACL,MAAA,MAAA,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,qBAAqB,CAAC,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,mCACzE,UAAU,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,mCACvC,kBAAkB,CAAC,IAAI,EAAE,UAAU,CAAC,CACrC,CAAC;AACJ,CAAC;AAfD,kCAeC;AAED,sEAAsE;AACtE,SAAS,qBAAqB,CAAC,IAAY;IACzC,MAAM,MAAM,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;IACxE,OAAO,MAAM,CAAC,MAAM,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google LLC. Use of this source code is governed by an
3
+ // MIT-style license that can be found in the LICENSE file or at
4
+ // https://opensource.org/licenses/MIT.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LegacyValueBase = void 0;
7
+ /**
8
+ * A base class for legacy value types. A shared base class makes it easier to
9
+ * detect legacy values and extract their inner value objects.
10
+ */
11
+ class LegacyValueBase {
12
+ constructor(inner) {
13
+ this.inner = inner;
14
+ }
15
+ }
16
+ exports.LegacyValueBase = LegacyValueBase;
17
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
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;IAC1B,YAAmB,KAAQ;QAAR,UAAK,GAAL,KAAK,CAAG;IAAG,CAAC;CAChC;AAFD,0CAEC"}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ // Copyright 2022 Google LLC. Use of this source code is governed by an
3
+ // MIT-style license that can be found in the LICENSE file or at
4
+ // https://opensource.org/licenses/MIT.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LegacyColor = void 0;
7
+ const color_1 = require("../../value/color");
8
+ const base_1 = require("./base");
9
+ class LegacyColor extends base_1.LegacyValueBase {
10
+ constructor(redOrArgb, green, blue, alpha) {
11
+ if (redOrArgb instanceof color_1.SassColor) {
12
+ super(redOrArgb);
13
+ return;
14
+ }
15
+ let red;
16
+ if (!green || !blue) {
17
+ const argb = redOrArgb;
18
+ alpha = (argb >> 24) / 0xff;
19
+ red = (argb >> 16) % 0x100;
20
+ green = (argb >> 8) % 0x100;
21
+ blue = argb % 0x100;
22
+ }
23
+ else {
24
+ red = redOrArgb;
25
+ }
26
+ super(new color_1.SassColor({
27
+ red: clamp(red, 0, 255),
28
+ green: clamp(green, 0, 255),
29
+ blue: clamp(blue, 0, 255),
30
+ alpha: alpha ? clamp(alpha, 0, 1) : 1,
31
+ }));
32
+ }
33
+ getR() {
34
+ return this.inner.red;
35
+ }
36
+ setR(value) {
37
+ this.inner = this.inner.change({ red: clamp(value, 0, 255) });
38
+ }
39
+ getG() {
40
+ return this.inner.green;
41
+ }
42
+ setG(value) {
43
+ this.inner = this.inner.change({ green: clamp(value, 0, 255) });
44
+ }
45
+ getB() {
46
+ return this.inner.blue;
47
+ }
48
+ setB(value) {
49
+ this.inner = this.inner.change({ blue: clamp(value, 0, 255) });
50
+ }
51
+ getA() {
52
+ return this.inner.alpha;
53
+ }
54
+ setA(value) {
55
+ this.inner = this.inner.change({ alpha: clamp(value, 0, 1) });
56
+ }
57
+ }
58
+ exports.LegacyColor = LegacyColor;
59
+ Object.defineProperty(LegacyColor, 'name', { value: 'sass.types.Color' });
60
+ // Returns `number` clamped to between `min` and `max`.
61
+ function clamp(num, min, max) {
62
+ return Math.min(Math.max(num, min), max);
63
+ }
64
+ //# sourceMappingURL=color.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color.js","sourceRoot":"","sources":["../../../../../lib/src/legacy/value/color.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,6CAA4C;AAC5C,iCAAuC;AAEvC,MAAa,WAAY,SAAQ,sBAA0B;IAKzD,YACE,SAA6B,EAC7B,KAAc,EACd,IAAa,EACb,KAAc;QAEd,IAAI,SAAS,YAAY,iBAAS,EAAE;YAClC,KAAK,CAAC,SAAS,CAAC,CAAC;YACjB,OAAO;SACR;QAED,IAAI,GAAW,CAAC;QAChB,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE;YACnB,MAAM,IAAI,GAAG,SAAmB,CAAC;YACjC,KAAK,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;YAC5B,GAAG,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC;YAC3B,KAAK,GAAG,CAAC,I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,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"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ // Copyright 2022 Google LLC. Use of this source code is governed by an
3
+ // MIT-style license that can be found in the LICENSE file or at
4
+ // https://opensource.org/licenses/MIT.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Error = exports.String = exports.Number = exports.Null = exports.Map = exports.List = exports.Color = exports.Boolean = void 0;
7
+ const boolean_1 = require("../../value/boolean");
8
+ const null_1 = require("../../value/null");
9
+ const color_1 = require("./color");
10
+ const list_1 = require("./list");
11
+ const map_1 = require("./map");
12
+ const number_1 = require("./number");
13
+ const string_1 = require("./string");
14
+ exports.Boolean = boolean_1.SassBooleanInternal;
15
+ exports.Color = color_1.LegacyColor;
16
+ exports.List = list_1.LegacyList;
17
+ exports.Map = map_1.LegacyMap;
18
+ exports.Null = null_1.SassNull;
19
+ exports.Number = number_1.LegacyNumber;
20
+ exports.String = string_1.LegacyString;
21
+ // For the `sass.types.Error` object, we just re-export the native Error class.
22
+ exports.Error = global.Error;
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ // Copyright 2022 Google LLC. Use of this source code is governed by an
3
+ // MIT-style license that can be found in the LICENSE file or at
4
+ // https://opensource.org/licenses/MIT.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LegacyList = void 0;
7
+ const base_1 = require("./base");
8
+ const list_1 = require("../../value/list");
9
+ const null_1 = require("../../value/null");
10
+ const wrap_1 = require("./wrap");
11
+ class LegacyList extends base_1.LegacyValueBase {
12
+ constructor(lengthOrInner, commaSeparator) {
13
+ if (lengthOrInner instanceof list_1.SassList) {
14
+ super(lengthOrInner);
15
+ return;
16
+ }
17
+ super(new list_1.SassList(new Array(lengthOrInner).fill(null_1.sassNull), {
18
+ separator: commaSeparator === false ? ' ' : ',',
19
+ }));
20
+ }
21
+ getValue(index) {
22
+ const length = this.inner.asList.size;
23
+ if (index < 0 || index >= length) {
24
+ throw new Error(`Invalid index ${index}, must be between 0 and ${length}`);
25
+ }
26
+ const value = this.inner.get(index);
27
+ return value ? (0, wrap_1.wrapValue)(value) : undefined;
28
+ }
29
+ setValue(index, value) {
30
+ this.inner = new list_1.SassList(this.inner.asList.set(index, (0, wrap_1.unwrapValue)(value)), {
31
+ separator: this.inner.separator,
32
+ brackets: this.inner.hasBrackets,
33
+ });
34
+ }
35
+ getSeparator() {
36
+ return this.inner.separator === ',';
37
+ }
38
+ setSeparator(isComma) {
39
+ this.inner = new list_1.SassList(this.inner.asList, {
40
+ separator: isComma ? ',' : ' ',
41
+ brackets: this.inner.hasBrackets,
42
+ });
43
+ }
44
+ getLength() {
45
+ return this.inner.asList.size;
46
+ }
47
+ }
48
+ exports.LegacyList = LegacyList;
49
+ Object.defineProperty(LegacyList, 'name', { value: 'sass.types.List' });
50
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
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;YACrC,KAAK,CAAC,aAAa,CAAC,CAAC;YACrB,OAAO;SACR;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;YAChC,MAAM,IAAI,KAAK,CACb,iBAAiB,KAAK,2BAA2B,MAAM,EAAE,CAC1D,CAAC;SACH;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"}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ // Copyright 2022 Google LLC. Use of this source code is governed by an
3
+ // MIT-style license that can be found in the LICENSE file or at
4
+ // https://opensource.org/licenses/MIT.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LegacyMap = void 0;
7
+ const immutable_1 = require("immutable");
8
+ const base_1 = require("./base");
9
+ const map_1 = require("../../value/map");
10
+ const number_1 = require("../../value/number");
11
+ const null_1 = require("../../value/null");
12
+ const wrap_1 = require("./wrap");
13
+ class LegacyMap extends base_1.LegacyValueBase {
14
+ constructor(lengthOrInner) {
15
+ if (lengthOrInner instanceof map_1.SassMap) {
16
+ super(lengthOrInner);
17
+ return;
18
+ }
19
+ super(new map_1.SassMap((0, immutable_1.OrderedMap)(Array.from({ length: lengthOrInner }, (_, i) => [
20
+ new number_1.SassNumber(i),
21
+ null_1.sassNull,
22
+ ]))));
23
+ }
24
+ getValue(index) {
25
+ const value = this.inner.contents.valueSeq().get(index);
26
+ if (index < 0 || !value) {
27
+ throw new Error(`Invalid index ${index}, must be between 0 and ` +
28
+ this.inner.contents.size);
29
+ }
30
+ return (0, wrap_1.wrapValue)(value);
31
+ }
32
+ setValue(index, value) {
33
+ this.inner = new map_1.SassMap(this.inner.contents.set(this.getUnwrappedKey(index), (0, wrap_1.unwrapValue)(value)));
34
+ }
35
+ getKey(index) {
36
+ return (0, wrap_1.wrapValue)(this.getUnwrappedKey(index));
37
+ }
38
+ // Like `getKey()`, but returns the unwrapped non-legacy value.
39
+ getUnwrappedKey(index) {
40
+ const key = this.inner.contents.keySeq().get(index);
41
+ if (index >= 0 && key)
42
+ return key;
43
+ throw new Error(`Invalid index ${index}, must be between 0 and ` +
44
+ this.inner.contents.size);
45
+ }
46
+ setKey(index, key) {
47
+ const oldMap = this.inner.contents;
48
+ if (index < 0 || index >= oldMap.size) {
49
+ throw new Error(`Invalid index ${index}, must be between 0 and ${oldMap.size}`);
50
+ }
51
+ const newKey = (0, wrap_1.unwrapValue)(key);
52
+ const newMap = (0, immutable_1.OrderedMap)().asMutable();
53
+ let i = 0;
54
+ for (const [oldKey, oldValue] of oldMap.entries()) {
55
+ if (i === index) {
56
+ newMap.set(newKey, oldValue);
57
+ }
58
+ else {
59
+ if (newKey.equals(oldKey)) {
60
+ throw new Error(`${key} is already in the map`);
61
+ }
62
+ newMap.set(oldKey, oldValue);
63
+ }
64
+ i++;
65
+ }
66
+ this.inner = new map_1.SassMap(newMap.asImmutable());
67
+ }
68
+ getLength() {
69
+ return this.inner.contents.size;
70
+ }
71
+ }
72
+ exports.LegacyMap = LegacyMap;
73
+ Object.defineProperty(LegacyMap, 'name', { value: 'sass.types.Map' });
74
+ //# sourceMappingURL=map.js.map
@@ -0,0 +1 @@
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;YACpC,KAAK,CAAC,aAAa,CAAC,CAAC;YACrB,OAAO;SACR;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;YACvB,MAAM,IAAI,KAAK,CACb,iBAAiB,KAAK,0BAA0B;gBAC9C,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC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MAAM,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,EAAE;YACjD,IAAI,CAAC,KAAK,KAAK,EAAE;gBACf,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;aAC9B;iBAAM;gBACL,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;oBACzB,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,wBAAwB,CAAC,CAAC;iBACjD;gBACD,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;aAC9B;YACD,CAAC,EAAE,CAAC;SACL;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"}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ // Copyright 2022 Google LLC. Use of this source code is governed by an
3
+ // MIT-style license that can be found in the LICENSE file or at
4
+ // https://opensource.org/licenses/MIT.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LegacyNumber = void 0;
7
+ const number_1 = require("../../value/number");
8
+ const base_1 = require("./base");
9
+ class LegacyNumber extends base_1.LegacyValueBase {
10
+ constructor(valueOrInner, unit) {
11
+ super(valueOrInner instanceof number_1.SassNumber
12
+ ? valueOrInner
13
+ : parseNumber(valueOrInner, unit));
14
+ }
15
+ getValue() {
16
+ return this.inner.value;
17
+ }
18
+ setValue(value) {
19
+ this.inner = new number_1.SassNumber(value, {
20
+ numeratorUnits: this.inner.numeratorUnits,
21
+ denominatorUnits: this.inner.denominatorUnits,
22
+ });
23
+ }
24
+ getUnit() {
25
+ return (this.inner.numeratorUnits.join('*') +
26
+ (this.inner.denominatorUnits.size === 0 ? '' : '/') +
27
+ this.inner.denominatorUnits.join('*'));
28
+ }
29
+ setUnit(unit) {
30
+ this.inner = parseNumber(this.inner.value, unit);
31
+ }
32
+ }
33
+ exports.LegacyNumber = LegacyNumber;
34
+ Object.defineProperty(LegacyNumber, 'name', { value: 'sass.types.Number' });
35
+ // Parses a `SassNumber` from `value` and `unit`, using Node Sass's unit
36
+ // format.
37
+ function parseNumber(value, unit) {
38
+ if (!unit)
39
+ return new number_1.SassNumber(value);
40
+ if (!unit.includes('*') && !unit.includes('/')) {
41
+ return new number_1.SassNumber(value, unit);
42
+ }
43
+ const invalidUnit = new Error(`Unit ${unit} is invalid`);
44
+ const operands = unit.split('/');
45
+ if (operands.length > 2)
46
+ throw invalidUnit;
47
+ const numerator = operands[0];
48
+ const denominator = operands.length === 1 ? null : operands[1];
49
+ const numeratorUnits = numerator.length === 0 ? [] : numerator.split('*');
50
+ if (numeratorUnits.some(unit => unit.length === 0))
51
+ throw invalidUnit;
52
+ const denominatorUnits = denominator === null ? [] : denominator.split('*');
53
+ if (denominatorUnits.some(unit => unit.length === 0))
54
+ throw invalidUnit;
55
+ return new number_1.SassNumber(value, {
56
+ numeratorUnits: numeratorUnits,
57
+ denominatorUnits: denominatorUnits,
58
+ });
59
+ }
60
+ //# sourceMappingURL=number.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number.js","sourceRoot":"","sources":["../../../../../lib/src/legacy/value/number.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,+CAA8C;AAC9C,iCAAuC;AAEvC,MAAa,YAAa,SAAQ,sBAA2B;IAC3D,YAAY,YAAiC,EAAE,IAAa;QAC1D,KAAK,CACH,YAAY,YAAY,mBAAU;YAChC,CAAC,CAAC,YAAY;YACd,CAAC,CAAC,WAAW,CAAC,YAAY,EAAE,IAAI,CAAC,CACpC,CAAC;IACJ,CAAC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AC;IAEzD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,WAAW,CAAC;IAE3C,MAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC9B,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE/D,MAAM,cAAc,GAAG,SAAS,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1E,IAAI,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;QAAE,MAAM,WAAW,CAAC;IAEtE,MAAM,gBAAgB,GAAG,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5E,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;QAAE,MAAM,WAAW,CAAC;IAExE,OAAO,IAAI,mBAAU,CAAC,KAAK,EAAE;QAC3B,cAAc,EAAE,cAAc;QAC9B,gBAAgB,EAAE,gBAAgB;KACnC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ // Copyright 2022 Google LLC. Use of this source code is governed by an
3
+ // MIT-style license that can be found in the LICENSE file or at
4
+ // https://opensource.org/licenses/MIT.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LegacyString = void 0;
7
+ const string_1 = require("../../value/string");
8
+ const base_1 = require("./base");
9
+ class LegacyString extends base_1.LegacyValueBase {
10
+ constructor(valueOrInner) {
11
+ if (valueOrInner instanceof string_1.SassString) {
12
+ super(valueOrInner);
13
+ }
14
+ else {
15
+ super(new string_1.SassString(valueOrInner, { quotes: false }));
16
+ }
17
+ }
18
+ getValue() {
19
+ return this.inner.text;
20
+ }
21
+ setValue(value) {
22
+ this.inner = new string_1.SassString(value, { quotes: false });
23
+ }
24
+ }
25
+ exports.LegacyString = LegacyString;
26
+ Object.defineProperty(LegacyString, 'name', { value: 'sass.types.String' });
27
+ //# sourceMappingURL=string.js.map
@@ -0,0 +1 @@
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;YACtC,KAAK,CAAC,YAAY,CAAC,CAAC;SACrB;aAAM;YACL,KAAK,CAAC,IAAI,mBAAU,CAAC,YAAY,EAAE,EAAC,MAAM,EAAE,KAAK,EAAC,CAAC,CAAC,CAAC;SACtD;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"}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ // Copyright 2022 Google LLC. Use of this source code is governed by an
3
+ // MIT-style license that can be found in the LICENSE file or at
4
+ // https://opensource.org/licenses/MIT.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.wrapValue = exports.unwrapValue = exports.wrapFunction = void 0;
7
+ const util = require("util");
8
+ const base_1 = require("./base");
9
+ const color_1 = require("./color");
10
+ const list_1 = require("./list");
11
+ const map_1 = require("./map");
12
+ const number_1 = require("./number");
13
+ const string_1 = require("./string");
14
+ const value_1 = require("../../value");
15
+ const color_2 = require("../../value/color");
16
+ const list_2 = require("../../value/list");
17
+ const map_2 = require("../../value/map");
18
+ const number_2 = require("../../value/number");
19
+ const string_2 = require("../../value/string");
20
+ /**
21
+ * Converts a `LegacyFunction` into a `CustomFunction` so it can be passed to
22
+ * the new JS API.
23
+ */
24
+ function wrapFunction(thisArg, callback, sync) {
25
+ if (sync) {
26
+ return args => unwrapTypedValue(callback.apply(thisArg, args.map(wrapValue)));
27
+ }
28
+ else {
29
+ return args => new Promise((resolve, reject) => {
30
+ const done = (result) => {
31
+ try {
32
+ if (result instanceof Error) {
33
+ reject(result);
34
+ }
35
+ else {
36
+ resolve(unwrapTypedValue(result));
37
+ }
38
+ }
39
+ catch (error) {
40
+ reject(error);
41
+ }
42
+ };
43
+ // The cast here is necesary to work around microsoft/TypeScript#33815.
44
+ const syncResult = callback.apply(thisArg, [...args.map(wrapValue), done]);
45
+ if (syncResult !== undefined)
46
+ resolve(unwrapTypedValue(syncResult));
47
+ });
48
+ }
49
+ }
50
+ exports.wrapFunction = wrapFunction;
51
+ // Like `unwrapValue()`, but returns a `types.Value` type.
52
+ function unwrapTypedValue(value) {
53
+ return unwrapValue(value);
54
+ }
55
+ /** Converts a value returned by a `LegacyFunction` into a `Value`. */
56
+ function unwrapValue(value) {
57
+ if (value instanceof Error)
58
+ throw value;
59
+ if (value instanceof value_1.Value)
60
+ return value;
61
+ if (value instanceof base_1.LegacyValueBase)
62
+ return value.inner;
63
+ throw new Error(`Expected legacy Sass value, got ${util.inspect(value)}.`);
64
+ }
65
+ exports.unwrapValue = unwrapValue;
66
+ /** Converts a `Value` into a `LegacyValue`. */
67
+ function wrapValue(value) {
68
+ if (value instanceof color_2.SassColor)
69
+ return new color_1.LegacyColor(value);
70
+ if (value instanceof list_2.SassList)
71
+ return new list_1.LegacyList(value);
72
+ if (value instanceof map_2.SassMap)
73
+ return new map_1.LegacyMap(value);
74
+ if (value instanceof number_2.SassNumber)
75
+ return new number_1.LegacyNumber(value);
76
+ if (value instanceof string_2.SassString)
77
+ return new string_1.LegacyString(value);
78
+ if (value instanceof value_1.Value)
79
+ return value;
80
+ throw new Error(`Expected Sass value, got ${util.inspect(value)}.`);
81
+ }
82
+ exports.wrapValue = wrapValue;
83
+ //# sourceMappingURL=wrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrap.js","sourceRoot":"","sources":["../../../../../lib/src/legacy/value/wrap.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,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;QACR,OAAO,IAAI,CAAC,EAAE,CACZ,gBAAgB,CACb,QAAmC,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CACzE,CAAC;KACL;SAAM;QACL,OAAO,IAAI,CAAC,EAAE,CACZ,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC9B,MAAM,IAAI,GAAG,CAAC,MAAe,EAAE,EAAE;gBAC/B,IAAI;oBACF,IAAI,MAAM,YAAY,KAAK,EAAE;wBAC3B,MAAM,CAAC,MAAM,CAAC,CAAC;qBAChB;yBAAM;wBACL,OAAO,CAAC,gBAA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CAAC,CAAC;IAChE,IAAI,KAAK,YAAY,mBAAU;QAAE,OAAO,IAAI,qBAAY,CAAC,KAAK,CAAC,CAAC;IAChE,IAAI,KAAK,YAAY,aAAK;QAAE,OAAO,KAAK,CAAC;IACzC,MAAM,IAAI,KAAK,CAAC,4BAA4B,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACtE,CAAC;AARD,8BAQC"}
@@ -3,7 +3,7 @@
3
3
  // MIT-style license that can be found in the LICENSE file or at
4
4
  // https://opensource.org/licenses/MIT.
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.putIfAbsent = exports.protofySyntax = exports.withoutExtension = exports.pathToUrlString = exports.valueError = exports.hostError = exports.mandatoryError = exports.compilerError = exports.asImmutableList = exports.isNullOrUndefined = exports.catchOr = exports.thenOr = void 0;
6
+ exports.putIfAbsent = exports.protofySyntax = exports.withoutExtension = exports.fileUrlToPathCrossPlatform = exports.pathToUrlString = exports.valueError = exports.hostError = exports.mandatoryError = exports.compilerError = exports.asImmutableList = exports.isNullOrUndefined = exports.catchOr = exports.thenOr = void 0;
7
7
  const immutable_1 = require("immutable");
8
8
  const p = require("path");
9
9
  const url = require("url");
@@ -75,6 +75,19 @@ function pathToUrlString(path) {
75
75
  return components.map(encodeURIComponent).join('/');
76
76
  }
77
77
  exports.pathToUrlString = pathToUrlString;
78
+ /**
79
+ * Like `url.fileURLToPath`, but returns the same result for Windows-style file
80
+ * URLs on all platforms.
81
+ */
82
+ function fileUrlToPathCrossPlatform(fileUrl) {
83
+ const path = url.fileURLToPath(fileUrl);
84
+ // Windows file: URLs begin with `file:///C:/` (or another drive letter),
85
+ // which `fileURLToPath` converts to `"/C:/"` on non-Windows systems. We want
86
+ // to ensure the behavior is consistent across OSes, so we normalize this back
87
+ // to a Windows-style path.
88
+ return /^\/[A-Za-z]:\//.test(path) ? path.substring(1) : path;
89
+ }
90
+ exports.fileUrlToPathCrossPlatform = fileUrlToPathCrossPlatform;
78
91
  /** Returns `path` without an extension, if it had one. */
79
92
  function withoutExtension(path) {
80
93
  const extension = p.extname(path);
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../lib/src/utils.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,gEAAgE;AAChE,uCAAuC;;;AAEvC,yCAA+B;AAC/B,0BAA0B;AAC1B,2BAA2B;AAE3B,qEAAqE;AAQrE;;;GAGG;AACH,SAAgB,MAAM,CACpB,cAAkC,EAClC,QAA0C;IAE1C,OAAO,cAAc,YAAY,OAAO;QACtC,CAAC,CAAE,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAwB;QACvD,CAAC,CAAC,QAAQ,CAAC,cAAmB,CAAC,CAAC;AACpC,CAAC;AAPD,wBAOC;AAED;;;GAGG;AACH,SAAgB,OAAO,CACrB,sBAAgD,EAChD,QAAgD;IAEhD,IAAI;QACF,MAAM,MAAM,GAAG,sBAAsB,EAAE,CAAC;QACxC,OAAO,MAAM,YAAY,OAAO;YAC9B,CAAC,CAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAwB;YAChD,CAAC,CAAC,MAAM,CAAC;KACZ;IAAC,OAAO,KAAc,EAAE;QACvB,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;KACxB;AACH,CAAC;AAZD,0BAYC;AAED,oCAAoC;AACpC,SAAgB,iBAAiB,CAC/B,MAA4B;IAE5B,OAAO,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS,CAAC;AACjD,CAAC;AAJD,8CAIC;AAED,iDAAiD;AACjD,SAAgB,eAAe,CAAI,UAAyB;IAC1D,OAAO,gBAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,gBAAI,EAAC,UAAU,CAAC,CAAC;AACjE,CAAC;AAFD,0CAEC;AAED,0CAA0C;AAC1C,SAAgB,aAAa,CAAC,OAAe;IAC3C,OAAO,KAAK,CAAC,0B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M,IAAI,KAAK,CAAC,oBAAoB,MAAM,GAAG,CAAC,CAAC;KAClD;AACH,CAAC;AAhBD,sCAgBC;AAED;;;GAGG;AACH,SAAgB,WAAW,CACzB,GAAc,EACd,GAAM,EACN,QAAiB;IAEjB,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,IAAI,GAAG,KAAK,SAAS,EAAE;QACrB,OAAO,GAAG,CAAC;KACZ;SAAM;QACL,MAAM,MAAM,GAAG,QAAQ,EAAE,CAAC;QAC1B,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACrB,OAAO,MAAM,CAAC;KACf;AACH,CAAC;AAbD,kCAaC"}
@@ -3,7 +3,7 @@
3
3
  // MIT-style license that can be found in the LICENSE file or at
4
4
  // https://opensource.org/licenses/MIT.
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.sassFalse = exports.sassTrue = void 0;
6
+ exports.sassFalse = exports.sassTrue = exports.SassBooleanInternal = void 0;
7
7
  const immutable_1 = require("immutable");
8
8
  const index_1 = require("./index");
9
9
  const trueHash = (0, immutable_1.hash)(true);
@@ -12,6 +12,10 @@ class SassBooleanInternal extends index_1.Value {
12
12
  constructor(valueInternal) {
13
13
  super();
14
14
  this.valueInternal = valueInternal;
15
+ if (!SassBooleanInternal.constructionAllowed) {
16
+ throw ("new sass.types.Boolean() isn't allowed.\n" +
17
+ 'Use sass.types.Boolean.TRUE or sass.types.Boolean.FALSE instead.');
18
+ }
15
19
  Object.freeze(this);
16
20
  }
17
21
  get value() {
@@ -32,9 +36,21 @@ class SassBooleanInternal extends index_1.Value {
32
36
  toString() {
33
37
  return this.value ? 'sassTrue' : 'sassFalse';
34
38
  }
39
+ getValue() {
40
+ return this.value;
41
+ }
35
42
  }
43
+ exports.SassBooleanInternal = SassBooleanInternal;
44
+ // Whether callers are allowed to construct this class. This is set to
45
+ // `false` once the two constants are constructed so that the constructor
46
+ // throws an error for future calls, in accordance with the legacy API.
47
+ SassBooleanInternal.constructionAllowed = true;
36
48
  /** The singleton instance of SassScript true. */
37
49
  exports.sassTrue = new SassBooleanInternal(true);
38
50
  /** The singleton instance of SassScript false. */
39
51
  exports.sassFalse = new SassBooleanInternal(false);
52
+ // Legacy API support
53
+ SassBooleanInternal.constructionAllowed = false;
54
+ SassBooleanInternal.TRUE = exports.sassTrue;
55
+ SassBooleanInternal.FALSE = exports.sassFalse;
40
56
  //# sourceMappingURL=boolean.js.map