@unpackjs/core 2.4.2 → 2.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/css-loader/index.js +22 -20
- package/compiled/less-loader/index.js +8 -8
- package/compiled/postcss-loader/index.js +8 -8
- package/compiled/sass-loader/index.d.ts +1 -961
- package/compiled/sass-loader/index.js +8 -8
- package/compiled/sass-loader/index1.js +4 -2
- package/dist/index.cjs +5 -5
- package/dist/index.js +5 -5
- package/dist-types/types/config.d.ts +2 -2
- package/dist-types/types/config.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1,961 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import * as Sass from 'sass';
|
|
3
|
-
import * as Webpack from 'webpack';
|
|
4
|
-
|
|
5
|
-
type ImporterReturnType =
|
|
6
|
-
| { file: string }
|
|
7
|
-
| { file?: string | undefined; contents: string }
|
|
8
|
-
| Error
|
|
9
|
-
| null
|
|
10
|
-
| types.Null
|
|
11
|
-
| types.Error;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* The context value is a value that is shared for the duration of a single render.
|
|
15
|
-
* The context object is the implicit `this` for importers and sass functions
|
|
16
|
-
* that are implemented in javascript.
|
|
17
|
-
*
|
|
18
|
-
* A render can be detected as asynchronous if the `callback` property is set on the context object.
|
|
19
|
-
*/
|
|
20
|
-
interface Context {
|
|
21
|
-
options: Options;
|
|
22
|
-
callback: SassRenderCallback | undefined;
|
|
23
|
-
[data: string]: any;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
interface AsyncContext extends Context {
|
|
27
|
-
callback: SassRenderCallback;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
interface SyncContext extends Context {
|
|
31
|
-
callback: undefined;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
type AsyncImporter = (
|
|
35
|
-
this: AsyncContext,
|
|
36
|
-
url: string,
|
|
37
|
-
prev: string,
|
|
38
|
-
done: (data: ImporterReturnType) => void,
|
|
39
|
-
) => void;
|
|
40
|
-
type SyncImporter = (this: SyncContext, url: string, prev: string) => ImporterReturnType;
|
|
41
|
-
type Importer = AsyncImporter | SyncImporter;
|
|
42
|
-
|
|
43
|
-
// These function types enumerate up to 6 js arguments. More than that will be incorrectly marked by the compiler as an error.
|
|
44
|
-
|
|
45
|
-
// ** Sync Sass functions receiving fixed # of arguments ***
|
|
46
|
-
type SyncSassFn = (this: SyncContext, ...$args: types.Value[]) => types.ReturnValue;
|
|
47
|
-
|
|
48
|
-
// ** Sync Sass functions receiving variable # of arguments ***
|
|
49
|
-
type SyncSassVarArgFn1 = (this: SyncContext, $arg1: types.Value[]) => types.ReturnValue;
|
|
50
|
-
type SyncSassVarArgFn2 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value[]) => types.ReturnValue;
|
|
51
|
-
type SyncSassVarArgFn3 = (
|
|
52
|
-
this: SyncContext,
|
|
53
|
-
$arg1: types.Value,
|
|
54
|
-
$arg2: types.Value,
|
|
55
|
-
$arg3: types.Value[],
|
|
56
|
-
) => types.ReturnValue;
|
|
57
|
-
type SyncSassVarArgFn4 = (
|
|
58
|
-
this: SyncContext,
|
|
59
|
-
$arg1: types.Value,
|
|
60
|
-
$arg2: types.Value,
|
|
61
|
-
$arg3: types.Value,
|
|
62
|
-
$arg4: types.Value[],
|
|
63
|
-
) => types.ReturnValue;
|
|
64
|
-
type SyncSassVarArgFn5 = (
|
|
65
|
-
this: SyncContext,
|
|
66
|
-
$arg1: types.Value,
|
|
67
|
-
$arg2: types.Value,
|
|
68
|
-
$arg3: types.Value,
|
|
69
|
-
$arg4: types.Value,
|
|
70
|
-
$arg5: types.Value[],
|
|
71
|
-
) => types.ReturnValue;
|
|
72
|
-
type SyncSassVarArgFn6 = (
|
|
73
|
-
this: SyncContext,
|
|
74
|
-
$arg1: types.Value,
|
|
75
|
-
$arg2: types.Value,
|
|
76
|
-
$arg3: types.Value,
|
|
77
|
-
$arg4: types.Value,
|
|
78
|
-
$arg5: types.Value,
|
|
79
|
-
$arg6: types.Value[],
|
|
80
|
-
) => types.ReturnValue;
|
|
81
|
-
|
|
82
|
-
type SassFunctionCallback = ($result: types.ReturnValue) => void;
|
|
83
|
-
|
|
84
|
-
// ** Async Sass functions receiving fixed # of arguments ***
|
|
85
|
-
type AsyncSassFn0 = (this: AsyncContext, cb: SassFunctionCallback) => void;
|
|
86
|
-
type AsyncSassFn1 = (this: AsyncContext, $arg1: types.Value, cb: SassFunctionCallback) => void;
|
|
87
|
-
type AsyncSassFn2 = (
|
|
88
|
-
this: AsyncContext,
|
|
89
|
-
$arg1: types.Value,
|
|
90
|
-
$arg2: types.Value,
|
|
91
|
-
cb: SassFunctionCallback,
|
|
92
|
-
) => void;
|
|
93
|
-
type AsyncSassFn3 = (
|
|
94
|
-
this: AsyncContext,
|
|
95
|
-
$arg1: types.Value,
|
|
96
|
-
$arg2: types.Value,
|
|
97
|
-
$arg3: types.Value,
|
|
98
|
-
cb: SassFunctionCallback,
|
|
99
|
-
) => void;
|
|
100
|
-
type AsyncSassFn4 = (
|
|
101
|
-
this: AsyncContext,
|
|
102
|
-
$arg1: types.Value,
|
|
103
|
-
$arg2: types.Value,
|
|
104
|
-
$arg3: types.Value,
|
|
105
|
-
$arg4: types.Value,
|
|
106
|
-
cb: SassFunctionCallback,
|
|
107
|
-
) => void;
|
|
108
|
-
type AsyncSassFn5 = (
|
|
109
|
-
this: AsyncContext,
|
|
110
|
-
$arg1: types.Value,
|
|
111
|
-
$arg2: types.Value,
|
|
112
|
-
$arg3: types.Value,
|
|
113
|
-
$arg4: types.Value,
|
|
114
|
-
$arg5: types.Value,
|
|
115
|
-
cb: SassFunctionCallback,
|
|
116
|
-
) => void;
|
|
117
|
-
type AsyncSassFn6 = (
|
|
118
|
-
this: AsyncContext,
|
|
119
|
-
$arg1: types.Value,
|
|
120
|
-
$arg2: types.Value,
|
|
121
|
-
$arg3: types.Value,
|
|
122
|
-
$arg4: types.Value,
|
|
123
|
-
$arg5: types.Value,
|
|
124
|
-
$arg6: types.Value,
|
|
125
|
-
cb: SassFunctionCallback,
|
|
126
|
-
) => void;
|
|
127
|
-
|
|
128
|
-
// *** Async Sass Functions receiving variable # of arguments ***
|
|
129
|
-
type AsyncSassVarArgFn1 = (this: AsyncContext, $arg1: types.Value[], cb: SassFunctionCallback) => void;
|
|
130
|
-
type AsyncSassVarArgFn2 = (
|
|
131
|
-
this: AsyncContext,
|
|
132
|
-
$arg1: types.Value,
|
|
133
|
-
$arg2: types.Value[],
|
|
134
|
-
cb: SassFunctionCallback,
|
|
135
|
-
) => void;
|
|
136
|
-
type AsyncSassVarArgFn3 = (
|
|
137
|
-
this: AsyncContext,
|
|
138
|
-
$arg1: types.Value,
|
|
139
|
-
$arg2: types.Value,
|
|
140
|
-
$arg3: types.Value[],
|
|
141
|
-
cb: SassFunctionCallback,
|
|
142
|
-
) => void;
|
|
143
|
-
type AsyncSassVarArgFn4 = (
|
|
144
|
-
this: AsyncContext,
|
|
145
|
-
$arg1: types.Value,
|
|
146
|
-
$arg2: types.Value,
|
|
147
|
-
$arg3: types.Value,
|
|
148
|
-
$arg4: types.Value[],
|
|
149
|
-
cb: SassFunctionCallback,
|
|
150
|
-
) => void;
|
|
151
|
-
type AsyncSassVarArgFn5 = (
|
|
152
|
-
this: AsyncContext,
|
|
153
|
-
$arg1: types.Value,
|
|
154
|
-
$arg2: types.Value,
|
|
155
|
-
$arg3: types.Value,
|
|
156
|
-
$arg4: types.Value,
|
|
157
|
-
$arg5: types.Value[],
|
|
158
|
-
cb: SassFunctionCallback,
|
|
159
|
-
) => void;
|
|
160
|
-
type AsyncSassVarArgFn6 = (
|
|
161
|
-
this: AsyncContext,
|
|
162
|
-
$arg1: types.Value,
|
|
163
|
-
$arg2: types.Value,
|
|
164
|
-
$arg3: types.Value,
|
|
165
|
-
$arg4: types.Value,
|
|
166
|
-
$arg5: types.Value,
|
|
167
|
-
$arg6: types.Value[],
|
|
168
|
-
cb: SassFunctionCallback,
|
|
169
|
-
) => void;
|
|
170
|
-
|
|
171
|
-
type SyncSassFunction =
|
|
172
|
-
| SyncSassFn
|
|
173
|
-
| SyncSassVarArgFn1
|
|
174
|
-
| SyncSassVarArgFn2
|
|
175
|
-
| SyncSassVarArgFn3
|
|
176
|
-
| SyncSassVarArgFn4
|
|
177
|
-
| SyncSassVarArgFn5
|
|
178
|
-
| SyncSassVarArgFn6;
|
|
179
|
-
|
|
180
|
-
type AsyncSassFunction =
|
|
181
|
-
| AsyncSassFn0
|
|
182
|
-
| AsyncSassFn1
|
|
183
|
-
| AsyncSassFn2
|
|
184
|
-
| AsyncSassFn3
|
|
185
|
-
| AsyncSassFn4
|
|
186
|
-
| AsyncSassFn5
|
|
187
|
-
| AsyncSassFn6
|
|
188
|
-
| AsyncSassVarArgFn1
|
|
189
|
-
| AsyncSassVarArgFn2
|
|
190
|
-
| AsyncSassVarArgFn3
|
|
191
|
-
| AsyncSassVarArgFn4
|
|
192
|
-
| AsyncSassVarArgFn5
|
|
193
|
-
| AsyncSassVarArgFn6;
|
|
194
|
-
|
|
195
|
-
type SassFunction = SyncSassFunction | AsyncSassFunction;
|
|
196
|
-
|
|
197
|
-
type FunctionDeclarations<FunctionType extends SassFunction = SassFunction> = Record<string, FunctionType>;
|
|
198
|
-
|
|
199
|
-
interface Options {
|
|
200
|
-
file?: string | undefined;
|
|
201
|
-
data?: string | undefined;
|
|
202
|
-
importer?: Importer | Importer[] | undefined;
|
|
203
|
-
functions?: FunctionDeclarations | undefined;
|
|
204
|
-
includePaths?: string[] | undefined;
|
|
205
|
-
indentedSyntax?: boolean | undefined;
|
|
206
|
-
indentType?: string | undefined;
|
|
207
|
-
indentWidth?: number | undefined;
|
|
208
|
-
linefeed?: string | undefined;
|
|
209
|
-
omitSourceMapUrl?: boolean | undefined;
|
|
210
|
-
outFile?: string | undefined;
|
|
211
|
-
outputStyle?: "compact" | "compressed" | "expanded" | "nested" | undefined;
|
|
212
|
-
precision?: number | undefined;
|
|
213
|
-
sourceComments?: boolean | undefined;
|
|
214
|
-
sourceMap?: boolean | string | undefined;
|
|
215
|
-
sourceMapContents?: boolean | undefined;
|
|
216
|
-
sourceMapEmbed?: boolean | undefined;
|
|
217
|
-
sourceMapRoot?: string | undefined;
|
|
218
|
-
[key: string]: any;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* The error object returned to javascript by sass's render methods.
|
|
223
|
-
*
|
|
224
|
-
* This is not the same thing as types.Error.
|
|
225
|
-
*/
|
|
226
|
-
interface SassError extends Error {
|
|
227
|
-
message: string;
|
|
228
|
-
line: number;
|
|
229
|
-
column: number;
|
|
230
|
-
status: number;
|
|
231
|
-
file: string;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* The result of successfully compiling a Sass file.
|
|
236
|
-
*/
|
|
237
|
-
interface Result {
|
|
238
|
-
css: Buffer;
|
|
239
|
-
map: Buffer;
|
|
240
|
-
stats: {
|
|
241
|
-
entry: string;
|
|
242
|
-
start: number;
|
|
243
|
-
end: number;
|
|
244
|
-
duration: number;
|
|
245
|
-
includedFiles: string[];
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
type SassRenderCallback = (err: SassError, result: Result) => any;
|
|
249
|
-
|
|
250
|
-
// Note, most node-sass constructors can be invoked as a function or with a new
|
|
251
|
-
// operator. The exception: the types Null and Boolean for which new is
|
|
252
|
-
// forbidden.
|
|
253
|
-
//
|
|
254
|
-
// Because of this, the new-able object notation is used here, a class does not
|
|
255
|
-
// work for these types.
|
|
256
|
-
declare namespace types {
|
|
257
|
-
/* tslint:disable:ban-types */
|
|
258
|
-
/**
|
|
259
|
-
* Values that are received from Sass as an argument to a javascript function.
|
|
260
|
-
*/
|
|
261
|
-
export type Value = Null | Number | String | Color | Boolean | List | Map;
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Values that are legal to return to Sass from a javascript function.
|
|
265
|
-
*/
|
|
266
|
-
export type ReturnValue = Value | Error;
|
|
267
|
-
|
|
268
|
-
// *** Sass Null ***
|
|
269
|
-
|
|
270
|
-
export interface Null {
|
|
271
|
-
/**
|
|
272
|
-
* This property doesn't exist, but its presence forces the typescript
|
|
273
|
-
* compiler to properly type check this type. Without it, it seems to
|
|
274
|
-
* allow things that aren't types.Null to match it in case statements and
|
|
275
|
-
* assignments.
|
|
276
|
-
*/
|
|
277
|
-
readonly ___NULL___: unique symbol;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
interface NullConstructor {
|
|
281
|
-
(): Null;
|
|
282
|
-
NULL: Null;
|
|
283
|
-
}
|
|
284
|
-
export const Null: NullConstructor;
|
|
285
|
-
|
|
286
|
-
// *** Sass Number ***
|
|
287
|
-
|
|
288
|
-
export interface Number {
|
|
289
|
-
getValue(): number;
|
|
290
|
-
setValue(n: number): void;
|
|
291
|
-
getUnit(): string;
|
|
292
|
-
setUnit(u: string): void;
|
|
293
|
-
}
|
|
294
|
-
interface NumberConstructor {
|
|
295
|
-
/**
|
|
296
|
-
* Constructs a new Sass number. Does not require use of the `new` keyword.
|
|
297
|
-
*/
|
|
298
|
-
new(value: number, unit?: string): Number;
|
|
299
|
-
/**
|
|
300
|
-
* Constructs a new Sass number. Can also be used with the `new` keyword.
|
|
301
|
-
*/
|
|
302
|
-
(value: number, unit?: string): Number;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
export const Number: NumberConstructor;
|
|
306
|
-
|
|
307
|
-
// *** Sass String ***
|
|
308
|
-
|
|
309
|
-
export interface String {
|
|
310
|
-
getValue(): string;
|
|
311
|
-
setValue(s: string): void;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
interface StringConstructor {
|
|
315
|
-
/**
|
|
316
|
-
* Constructs a new Sass string. Does not require use of the `new` keyword.
|
|
317
|
-
*/
|
|
318
|
-
new(value: string): String;
|
|
319
|
-
/**
|
|
320
|
-
* Constructs a new Sass string. Can also be used with the `new` keyword.
|
|
321
|
-
*/
|
|
322
|
-
(value: string): String;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
export const String: StringConstructor;
|
|
326
|
-
|
|
327
|
-
// *** Sass Color ***
|
|
328
|
-
|
|
329
|
-
export interface Color {
|
|
330
|
-
/**
|
|
331
|
-
* Get the red component of the color.
|
|
332
|
-
* @returns integer between 0 and 255 inclusive;
|
|
333
|
-
*/
|
|
334
|
-
getR(): number;
|
|
335
|
-
/**
|
|
336
|
-
* Set the red component of the color.
|
|
337
|
-
* @returns integer between 0 and 255 inclusive;
|
|
338
|
-
*/
|
|
339
|
-
setR(r: number): void;
|
|
340
|
-
/**
|
|
341
|
-
* Get the green component of the color.
|
|
342
|
-
* @returns integer between 0 and 255 inclusive;
|
|
343
|
-
*/
|
|
344
|
-
getG(): number;
|
|
345
|
-
/**
|
|
346
|
-
* Set the green component of the color.
|
|
347
|
-
* @param g integer between 0 and 255 inclusive;
|
|
348
|
-
*/
|
|
349
|
-
setG(g: number): void;
|
|
350
|
-
/**
|
|
351
|
-
* Get the blue component of the color.
|
|
352
|
-
* @returns integer between 0 and 255 inclusive;
|
|
353
|
-
*/
|
|
354
|
-
getB(): number;
|
|
355
|
-
/**
|
|
356
|
-
* Set the blue component of the color.
|
|
357
|
-
* @param b integer between 0 and 255 inclusive;
|
|
358
|
-
*/
|
|
359
|
-
setB(b: number): void;
|
|
360
|
-
/**
|
|
361
|
-
* Get the alpha transparency component of the color.
|
|
362
|
-
* @returns number between 0 and 1 inclusive;
|
|
363
|
-
*/
|
|
364
|
-
getA(): number;
|
|
365
|
-
/**
|
|
366
|
-
* Set the alpha component of the color.
|
|
367
|
-
* @param a number between 0 and 1 inclusive;
|
|
368
|
-
*/
|
|
369
|
-
setA(a: number): void;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
interface ColorConstructor {
|
|
373
|
-
/**
|
|
374
|
-
* Constructs a new Sass color given the RGBA component values. Do not invoke with the `new` keyword.
|
|
375
|
-
*
|
|
376
|
-
* @param r integer 0-255 inclusive
|
|
377
|
-
* @param g integer 0-255 inclusive
|
|
378
|
-
* @param b integer 0-255 inclusive
|
|
379
|
-
* @param [a] float 0 - 1 inclusive
|
|
380
|
-
* @returns a SassColor instance.
|
|
381
|
-
*/
|
|
382
|
-
new(r: number, g: number, b: number, a?: number): Color;
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
* Constructs a new Sass color given a 4 byte number. Do not invoke with the `new` keyword.
|
|
386
|
-
*
|
|
387
|
-
* If a single number is passed it is assumed to be a number that contains
|
|
388
|
-
* all the components which are extracted using bitmasks and bitshifting.
|
|
389
|
-
*
|
|
390
|
-
* @param hexN A number that is usually written in hexadecimal form. E.g. 0xff0088cc.
|
|
391
|
-
* @returns a Sass Color instance.
|
|
392
|
-
* @example
|
|
393
|
-
* // Comparison with byte array manipulation
|
|
394
|
-
* let a = new ArrayBuffer(4);
|
|
395
|
-
* let hexN = 0xCCFF0088; // 0xAARRGGBB
|
|
396
|
-
* let a32 = new Uint32Array(a); // Uint32Array [ 0 ]
|
|
397
|
-
* a32[0] = hexN;
|
|
398
|
-
* let a8 = new Uint8Array(a); // Uint8Array [ 136, 0, 255, 204 ]
|
|
399
|
-
* let componentBytes = [a8[2], a8[1], a8[0], a8[3] / 255] // [ 136, 0, 255, 0.8 ]
|
|
400
|
-
* let c = sass.types.Color(hexN);
|
|
401
|
-
* let components = [c.getR(), c.getG(), c.getR(), c.getA()] // [ 136, 0, 255, 0.8 ]
|
|
402
|
-
* assert.deepEqual(componentBytes, components); // does not raise.
|
|
403
|
-
*/
|
|
404
|
-
new(hexN: number): Color;
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* Constructs a new Sass color given the RGBA component values. Do not invoke with the `new` keyword.
|
|
408
|
-
*
|
|
409
|
-
* @param r integer 0-255 inclusive
|
|
410
|
-
* @param g integer 0-255 inclusive
|
|
411
|
-
* @param b integer 0-255 inclusive
|
|
412
|
-
* @param [a] float 0 - 1 inclusive
|
|
413
|
-
* @returns a SassColor instance.
|
|
414
|
-
*/
|
|
415
|
-
(r: number, g: number, b: number, a?: number): Color;
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* Constructs a new Sass color given a 4 byte number. Do not invoke with the `new` keyword.
|
|
419
|
-
*
|
|
420
|
-
* If a single number is passed it is assumed to be a number that contains
|
|
421
|
-
* all the components which are extracted using bitmasks and bitshifting.
|
|
422
|
-
*
|
|
423
|
-
* @param hexN A number that is usually written in hexadecimal form. E.g. 0xff0088cc.
|
|
424
|
-
* @returns a Sass Color instance.
|
|
425
|
-
* @example
|
|
426
|
-
* // Comparison with byte array manipulation
|
|
427
|
-
* let a = new ArrayBuffer(4);
|
|
428
|
-
* let hexN = 0xCCFF0088; // 0xAARRGGBB
|
|
429
|
-
* let a32 = new Uint32Array(a); // Uint32Array [ 0 ]
|
|
430
|
-
* a32[0] = hexN;
|
|
431
|
-
* let a8 = new Uint8Array(a); // Uint8Array [ 136, 0, 255, 204 ]
|
|
432
|
-
* let componentBytes = [a8[2], a8[1], a8[0], a8[3] / 255] // [ 136, 0, 255, 0.8 ]
|
|
433
|
-
* let c = sass.types.Color(hexN);
|
|
434
|
-
* let components = [c.getR(), c.getG(), c.getR(), c.getA()] // [ 136, 0, 255, 0.8 ]
|
|
435
|
-
* assert.deepEqual(componentBytes, components); // does not raise.
|
|
436
|
-
*/
|
|
437
|
-
(hexN: number): Color;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
export const Color: ColorConstructor;
|
|
441
|
-
|
|
442
|
-
// *** Sass Boolean ***
|
|
443
|
-
|
|
444
|
-
export interface Boolean {
|
|
445
|
-
getValue(): boolean;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
interface BooleanConstructor {
|
|
449
|
-
(bool: boolean): Boolean;
|
|
450
|
-
TRUE: Boolean;
|
|
451
|
-
FALSE: Boolean;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
export const Boolean: BooleanConstructor;
|
|
455
|
-
|
|
456
|
-
// *** Sass List ***
|
|
457
|
-
|
|
458
|
-
export interface Enumerable {
|
|
459
|
-
getValue(index: number): Value;
|
|
460
|
-
setValue(index: number, value: Value): void;
|
|
461
|
-
getLength(): number;
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
export interface List extends Enumerable {
|
|
465
|
-
getSeparator(): boolean;
|
|
466
|
-
setSeparator(isComma: boolean): void;
|
|
467
|
-
}
|
|
468
|
-
interface ListConstructor {
|
|
469
|
-
new(length: number, commaSeparator?: boolean): List;
|
|
470
|
-
(length: number, commaSeparator?: boolean): List;
|
|
471
|
-
}
|
|
472
|
-
export const List: ListConstructor;
|
|
473
|
-
|
|
474
|
-
// *** Sass Map ***
|
|
475
|
-
|
|
476
|
-
export interface Map extends Enumerable {
|
|
477
|
-
getKey(index: number): Value;
|
|
478
|
-
setKey(index: number, key: Value): void;
|
|
479
|
-
}
|
|
480
|
-
interface MapConstructor {
|
|
481
|
-
new(length: number): Map;
|
|
482
|
-
(length: number): Map;
|
|
483
|
-
}
|
|
484
|
-
export const Map: MapConstructor;
|
|
485
|
-
|
|
486
|
-
// *** Sass Error ***
|
|
487
|
-
|
|
488
|
-
export interface Error {
|
|
489
|
-
/**
|
|
490
|
-
* This property doesn't exist, but its presence forces the typescript
|
|
491
|
-
* compiler to properly type check this type. Without it, it seems to
|
|
492
|
-
* allow things that aren't types.Error to match it in case statements and
|
|
493
|
-
* assignments.
|
|
494
|
-
*/
|
|
495
|
-
readonly ___SASS_ERROR___: unique symbol;
|
|
496
|
-
// why isn't there a getMessage() method?
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
interface ErrorConstructor {
|
|
500
|
-
/**
|
|
501
|
-
* An error return value for async functions.
|
|
502
|
-
* For synchronous functions, this can be returned or a standard error object can be thrown.
|
|
503
|
-
*/
|
|
504
|
-
new(message: string): Error;
|
|
505
|
-
/**
|
|
506
|
-
* An error return value for async functions.
|
|
507
|
-
* For synchronous functions, this can be returned or a standard error object can be thrown.
|
|
508
|
-
*/
|
|
509
|
-
(message: string): Error;
|
|
510
|
-
}
|
|
511
|
-
export const Error: ErrorConstructor;
|
|
512
|
-
|
|
513
|
-
/* eslint-enable @typescript-eslint/ban-types */
|
|
514
|
-
/* tslint:enable:ban-types */
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
interface LoaderOptions {
|
|
518
|
-
/**
|
|
519
|
-
* The special `implementation` option determines which implementation of Sass
|
|
520
|
-
* to use.
|
|
521
|
-
*
|
|
522
|
-
* By default the loader resolve the implementation based on your dependencies.
|
|
523
|
-
* Just add required implementation to `package.json` (`node-sass` or `sass`
|
|
524
|
-
* package) and install dependencies.
|
|
525
|
-
*
|
|
526
|
-
* Example where the `sass-loader` loader uses the `sass` (`dart-sass`)
|
|
527
|
-
* implementation:
|
|
528
|
-
*
|
|
529
|
-
* **package.json**
|
|
530
|
-
*
|
|
531
|
-
* ```json
|
|
532
|
-
* {
|
|
533
|
-
* "devDependencies": {
|
|
534
|
-
* "sass-loader": "^7.2.0",
|
|
535
|
-
* "sass": "^1.22.10"
|
|
536
|
-
* }
|
|
537
|
-
* }
|
|
538
|
-
* ```
|
|
539
|
-
*
|
|
540
|
-
* Example where the `sass-loader` loader uses the `node-sass` implementation:
|
|
541
|
-
*
|
|
542
|
-
* **package.json**
|
|
543
|
-
*
|
|
544
|
-
* ```json
|
|
545
|
-
* {
|
|
546
|
-
* "devDependencies": {
|
|
547
|
-
* "sass-loader": "^7.2.0",
|
|
548
|
-
* "node-sass": "^4.0.0"
|
|
549
|
-
* }
|
|
550
|
-
* }
|
|
551
|
-
* ```
|
|
552
|
-
*
|
|
553
|
-
* Beware the situation when `node-sass` and `sass` were installed! By default
|
|
554
|
-
* the `sass-loader` prefers `node-sass`. In order to avoid this situation you
|
|
555
|
-
* can use the `implementation` option.
|
|
556
|
-
*
|
|
557
|
-
* The `implementation` options either accepts `node-sass` or `sass` (`Dart Sass`)
|
|
558
|
-
* as a module.
|
|
559
|
-
*
|
|
560
|
-
* For example, to use Dart Sass, you'd pass:
|
|
561
|
-
*
|
|
562
|
-
* ```js
|
|
563
|
-
* module.exports = {
|
|
564
|
-
* module: {
|
|
565
|
-
* rules: [
|
|
566
|
-
* {
|
|
567
|
-
* test: /\.s[ac]ss$/i,
|
|
568
|
-
* use: [
|
|
569
|
-
* 'style-loader',
|
|
570
|
-
* 'css-loader',
|
|
571
|
-
* {
|
|
572
|
-
* loader: 'sass-loader',
|
|
573
|
-
* options: {
|
|
574
|
-
* // Prefer `dart-sass`
|
|
575
|
-
* implementation: require('sass'),
|
|
576
|
-
* },
|
|
577
|
-
* },
|
|
578
|
-
* ],
|
|
579
|
-
* },
|
|
580
|
-
* ],
|
|
581
|
-
* },
|
|
582
|
-
* };
|
|
583
|
-
* ```
|
|
584
|
-
*
|
|
585
|
-
* Note that when using `sass` (`Dart Sass`), **synchronous compilation is twice
|
|
586
|
-
* as fast as asynchronous compilation** by default, due to the overhead of
|
|
587
|
-
* asynchronous callbacks. To avoid this overhead, you can use the [fibers](https://www.npmjs.com/package/fibers)
|
|
588
|
-
* package to call asynchronous importers from the synchronous code path.
|
|
589
|
-
*
|
|
590
|
-
* We automatically inject the [`fibers`](https://github.com/laverdet/node-fibers)
|
|
591
|
-
* package (setup `sassOptions.fiber`) if is possible (i.e. you need install the
|
|
592
|
-
* [`fibers`](https://github.com/laverdet/node-fibers) package).
|
|
593
|
-
*
|
|
594
|
-
* **package.json**
|
|
595
|
-
*
|
|
596
|
-
* ```json
|
|
597
|
-
* {
|
|
598
|
-
* "devDependencies": {
|
|
599
|
-
* "sass-loader": "^7.2.0",
|
|
600
|
-
* "sass": "^1.22.10",
|
|
601
|
-
* "fibers": "^4.0.1"
|
|
602
|
-
* }
|
|
603
|
-
* }
|
|
604
|
-
* ```
|
|
605
|
-
*
|
|
606
|
-
* You can disable automatically injecting the [`fibers`](https://github.com/laverdet/node-fibers)
|
|
607
|
-
* package by passing a `false` value for the `sassOptions.fiber` option.
|
|
608
|
-
*
|
|
609
|
-
* **webpack.config.js**
|
|
610
|
-
*
|
|
611
|
-
* ```js
|
|
612
|
-
* module.exports = {
|
|
613
|
-
* module: {
|
|
614
|
-
* rules: [
|
|
615
|
-
* {
|
|
616
|
-
* test: /\.s[ac]ss$/i,
|
|
617
|
-
* use: [
|
|
618
|
-
* 'style-loader',
|
|
619
|
-
* 'css-loader',
|
|
620
|
-
* {
|
|
621
|
-
* loader: 'sass-loader',
|
|
622
|
-
* options: {
|
|
623
|
-
* implementation: require('sass'),
|
|
624
|
-
* sassOptions: {
|
|
625
|
-
* fiber: false,
|
|
626
|
-
* },
|
|
627
|
-
* },
|
|
628
|
-
* },
|
|
629
|
-
* ],
|
|
630
|
-
* },
|
|
631
|
-
* ],
|
|
632
|
-
* },
|
|
633
|
-
* };
|
|
634
|
-
* ```
|
|
635
|
-
*
|
|
636
|
-
* You can also pass the `fiber` value using this code:
|
|
637
|
-
*
|
|
638
|
-
* **webpack.config.js**
|
|
639
|
-
*
|
|
640
|
-
* ```js
|
|
641
|
-
* module.exports = {
|
|
642
|
-
* module: {
|
|
643
|
-
* rules: [
|
|
644
|
-
* {
|
|
645
|
-
* test: /\.s[ac]ss$/i,
|
|
646
|
-
* use: [
|
|
647
|
-
* 'style-loader',
|
|
648
|
-
* 'css-loader',
|
|
649
|
-
* {
|
|
650
|
-
* loader: 'sass-loader',
|
|
651
|
-
* options: {
|
|
652
|
-
* implementation: require('sass'),
|
|
653
|
-
* sassOptions: {
|
|
654
|
-
* fiber: require('fibers'),
|
|
655
|
-
* },
|
|
656
|
-
* },
|
|
657
|
-
* },
|
|
658
|
-
* ],
|
|
659
|
-
* },
|
|
660
|
-
* ],
|
|
661
|
-
* },
|
|
662
|
-
* };
|
|
663
|
-
* ```
|
|
664
|
-
*/
|
|
665
|
-
implementation?: any;
|
|
666
|
-
|
|
667
|
-
/**
|
|
668
|
-
* Options for [Node Sass](https://github.com/sass/node-sass) or [Dart Sass](http://sass-lang.com/dart-sass)
|
|
669
|
-
* implementation.
|
|
670
|
-
*
|
|
671
|
-
* > ℹ️ The `indentedSyntax` option has `true` value for the `sass` extension.
|
|
672
|
-
*
|
|
673
|
-
* > ℹ️ Options such as `file` and `outFile` are unavailable.
|
|
674
|
-
*
|
|
675
|
-
* > ℹ️ We recommend not to use the `sourceMapContents`, `sourceMapEmbed`,
|
|
676
|
-
* `sourceMapRoot` options because `sass-loader` automatically sets these
|
|
677
|
-
* options.
|
|
678
|
-
*
|
|
679
|
-
* There is a slight difference between the `node-sass` and `sass` (`Dart Sass`)
|
|
680
|
-
* options. Please consult documentation before using them:
|
|
681
|
-
*
|
|
682
|
-
* - [Node Sass documentation](https://github.com/sass/node-sass/#options) for
|
|
683
|
-
* all available `node-sass` options.
|
|
684
|
-
* - [Dart Sass documentation](https://github.com/sass/dart-sass#javascript-api)
|
|
685
|
-
* for all available `sass` options.
|
|
686
|
-
*
|
|
687
|
-
* #### `Object`
|
|
688
|
-
*
|
|
689
|
-
* Use and object for the Sass implementation setup.
|
|
690
|
-
*
|
|
691
|
-
* **webpack.config.js**
|
|
692
|
-
*
|
|
693
|
-
* ```js
|
|
694
|
-
* module.exports = {
|
|
695
|
-
* module: {
|
|
696
|
-
* rules: [
|
|
697
|
-
* {
|
|
698
|
-
* test: /\.s[ac]ss$/i,
|
|
699
|
-
* use: [
|
|
700
|
-
* 'style-loader',
|
|
701
|
-
* 'css-loader',
|
|
702
|
-
* {
|
|
703
|
-
* loader: 'sass-loader',
|
|
704
|
-
* options: {
|
|
705
|
-
* sassOptions: {
|
|
706
|
-
* indentWidth: 4,
|
|
707
|
-
* includePaths: ['absolute/path/a', 'absolute/path/b'],
|
|
708
|
-
* },
|
|
709
|
-
* },
|
|
710
|
-
* },
|
|
711
|
-
* ],
|
|
712
|
-
* },
|
|
713
|
-
* ],
|
|
714
|
-
* },
|
|
715
|
-
* };
|
|
716
|
-
* ```
|
|
717
|
-
*
|
|
718
|
-
* #### `Function`
|
|
719
|
-
*
|
|
720
|
-
* Allows to setup the Sass implementation by setting different options based on
|
|
721
|
-
* the loader context.
|
|
722
|
-
*
|
|
723
|
-
* ```js
|
|
724
|
-
* module.exports = {
|
|
725
|
-
* module: {
|
|
726
|
-
* rules: [
|
|
727
|
-
* {
|
|
728
|
-
* test: /\.s[ac]ss$/i,
|
|
729
|
-
* use: [
|
|
730
|
-
* 'style-loader',
|
|
731
|
-
* 'css-loader',
|
|
732
|
-
* {
|
|
733
|
-
* loader: 'sass-loader',
|
|
734
|
-
* options: {
|
|
735
|
-
* sassOptions: (loaderContext) => {
|
|
736
|
-
* // More information about available properties https://webpack.js.org/api/loaders/
|
|
737
|
-
* const { resourcePath, rootContext } = loaderContext;
|
|
738
|
-
* const relativePath = path.relative(rootContext, resourcePath);
|
|
739
|
-
*
|
|
740
|
-
* if (relativePath === 'styles/foo.scss') {
|
|
741
|
-
* return {
|
|
742
|
-
* includePaths: ['absolute/path/c', 'absolute/path/d'],
|
|
743
|
-
* };
|
|
744
|
-
* }
|
|
745
|
-
*
|
|
746
|
-
* return {
|
|
747
|
-
* includePaths: ['absolute/path/a', 'absolute/path/b'],
|
|
748
|
-
* };
|
|
749
|
-
* },
|
|
750
|
-
* },
|
|
751
|
-
* },
|
|
752
|
-
* ],
|
|
753
|
-
* },
|
|
754
|
-
* ],
|
|
755
|
-
* },
|
|
756
|
-
* };
|
|
757
|
-
* ```
|
|
758
|
-
*/
|
|
759
|
-
sassOptions?: LoaderOptions.SassOptions | LoaderOptions.Callback<LoaderOptions.SassOptions> | undefined;
|
|
760
|
-
|
|
761
|
-
/**
|
|
762
|
-
* Prepends `Sass`/`SCSS` code before the actual entry file. In this case, the
|
|
763
|
-
* `sass-loader` will not override the `data` option but just append the entry's
|
|
764
|
-
* content.
|
|
765
|
-
*
|
|
766
|
-
* This is especially useful when some of your Sass variables depend on the
|
|
767
|
-
* environment:
|
|
768
|
-
*
|
|
769
|
-
* > ℹ Since you're injecting code, this will break the source mappings in your
|
|
770
|
-
* entry file. Often there's a simpler solution than this, like multiple Sass
|
|
771
|
-
* entry files.
|
|
772
|
-
*
|
|
773
|
-
* #### `String`
|
|
774
|
-
*
|
|
775
|
-
* ```js
|
|
776
|
-
* module.exports = {
|
|
777
|
-
* module: {
|
|
778
|
-
* rules: [
|
|
779
|
-
* {
|
|
780
|
-
* test: /\.s[ac]ss$/i,
|
|
781
|
-
* use: [
|
|
782
|
-
* 'style-loader',
|
|
783
|
-
* 'css-loader',
|
|
784
|
-
* {
|
|
785
|
-
* loader: 'sass-loader',
|
|
786
|
-
* options: {
|
|
787
|
-
* prependData: '$env: ' + process.env.NODE_ENV + ';',
|
|
788
|
-
* },
|
|
789
|
-
* },
|
|
790
|
-
* ],
|
|
791
|
-
* },
|
|
792
|
-
* ],
|
|
793
|
-
* },
|
|
794
|
-
* };
|
|
795
|
-
* ```
|
|
796
|
-
*
|
|
797
|
-
* #### `Function`
|
|
798
|
-
*
|
|
799
|
-
* ```js
|
|
800
|
-
* module.exports = {
|
|
801
|
-
* module: {
|
|
802
|
-
* rules: [
|
|
803
|
-
* {
|
|
804
|
-
* test: /\.s[ac]ss$/i,
|
|
805
|
-
* use: [
|
|
806
|
-
* 'style-loader',
|
|
807
|
-
* 'css-loader',
|
|
808
|
-
* {
|
|
809
|
-
* loader: 'sass-loader',
|
|
810
|
-
* options: {
|
|
811
|
-
* prependData: (loaderContext) => {
|
|
812
|
-
* // More information about available properties https://webpack.js.org/api/loaders/
|
|
813
|
-
* const { resourcePath, rootContext } = loaderContext;
|
|
814
|
-
* const relativePath = path.relative(rootContext, resourcePath);
|
|
815
|
-
*
|
|
816
|
-
* if (relativePath === 'styles/foo.scss') {
|
|
817
|
-
* return '$value: 100px;';
|
|
818
|
-
* }
|
|
819
|
-
*
|
|
820
|
-
* return '$value: 200px;';
|
|
821
|
-
* },
|
|
822
|
-
* },
|
|
823
|
-
* },
|
|
824
|
-
* ],
|
|
825
|
-
* },
|
|
826
|
-
* ],
|
|
827
|
-
* },
|
|
828
|
-
* };
|
|
829
|
-
* ```
|
|
830
|
-
*
|
|
831
|
-
* @default
|
|
832
|
-
* undefined
|
|
833
|
-
*/
|
|
834
|
-
additionalData?: string | LoaderOptions.Callback<string> | undefined;
|
|
835
|
-
|
|
836
|
-
/**
|
|
837
|
-
* Enables/Disables generation of source maps.
|
|
838
|
-
*
|
|
839
|
-
* By default generation of source maps depends on the [`devtool`](https://webpack.js.org/configuration/devtool/)
|
|
840
|
-
* option. All values enable source map generation except `eval` and `false`
|
|
841
|
-
* value.
|
|
842
|
-
*
|
|
843
|
-
* **webpack.config.js**
|
|
844
|
-
*
|
|
845
|
-
* ```js
|
|
846
|
-
* module.exports = {
|
|
847
|
-
* module: {
|
|
848
|
-
* rules: [
|
|
849
|
-
* {
|
|
850
|
-
* test: /\.s[ac]ss$/i,
|
|
851
|
-
* use: [
|
|
852
|
-
* 'style-loader',
|
|
853
|
-
* {
|
|
854
|
-
* loader: 'css-loader',
|
|
855
|
-
* options: {
|
|
856
|
-
* sourceMap: true,
|
|
857
|
-
* },
|
|
858
|
-
* },
|
|
859
|
-
* {
|
|
860
|
-
* loader: 'sass-loader',
|
|
861
|
-
* options: {
|
|
862
|
-
* sourceMap: true,
|
|
863
|
-
* },
|
|
864
|
-
* },
|
|
865
|
-
* ],
|
|
866
|
-
* },
|
|
867
|
-
* ],
|
|
868
|
-
* },
|
|
869
|
-
* };
|
|
870
|
-
* ```
|
|
871
|
-
*
|
|
872
|
-
* > ℹ In some rare cases `node-sass` can output invalid source maps (it is a
|
|
873
|
-
* `node-sass` bug). In order to avoid this, you can try to update `node-sass`
|
|
874
|
-
* to latest version or you can try to set within `sassOptions` the
|
|
875
|
-
* `outputStyle` option to `compressed`.
|
|
876
|
-
*
|
|
877
|
-
* @default
|
|
878
|
-
* Depends on the `compiler.devtool` value.
|
|
879
|
-
*/
|
|
880
|
-
sourceMap?: boolean | undefined;
|
|
881
|
-
|
|
882
|
-
/**
|
|
883
|
-
* Enables/Disables the default Webpack importer.
|
|
884
|
-
*
|
|
885
|
-
* This can improve performance in some cases. Use it with caution because
|
|
886
|
-
* aliases and `@import` at-rules starting with `~` will not work. You can pass
|
|
887
|
-
* own `importer` to solve this (see [`importer docs`](https://github.com/sass/node-sass#importer--v200---experimental)).
|
|
888
|
-
*
|
|
889
|
-
* **webpack.config.js**
|
|
890
|
-
*
|
|
891
|
-
* ```js
|
|
892
|
-
* module.exports = {
|
|
893
|
-
* module: {
|
|
894
|
-
* rules: [
|
|
895
|
-
* {
|
|
896
|
-
* test: /\.s[ac]ss$/i,
|
|
897
|
-
* use: [
|
|
898
|
-
* 'style-loader',
|
|
899
|
-
* 'css-loader',
|
|
900
|
-
* {
|
|
901
|
-
* loader: 'sass-loader',
|
|
902
|
-
* options: {
|
|
903
|
-
* webpackImporter: false,
|
|
904
|
-
* },
|
|
905
|
-
* },
|
|
906
|
-
* ],
|
|
907
|
-
* },
|
|
908
|
-
* ],
|
|
909
|
-
* },
|
|
910
|
-
* };
|
|
911
|
-
* ```
|
|
912
|
-
*
|
|
913
|
-
* @default
|
|
914
|
-
* true
|
|
915
|
-
*/
|
|
916
|
-
webpackImporter?: boolean | undefined;
|
|
917
|
-
/**
|
|
918
|
-
* Treats the @warn rule as a webpack warning.
|
|
919
|
-
*
|
|
920
|
-
* Note: It will be true by default in the next major release.
|
|
921
|
-
*
|
|
922
|
-
* **webpack.config.js**
|
|
923
|
-
*
|
|
924
|
-
* ```js
|
|
925
|
-
* module.exports = {
|
|
926
|
-
* module: {
|
|
927
|
-
* rules: [
|
|
928
|
-
* {
|
|
929
|
-
* test: /\.s[ac]ss$/i,
|
|
930
|
-
* use: [
|
|
931
|
-
* 'style-loader',
|
|
932
|
-
* 'css-loader',
|
|
933
|
-
* {
|
|
934
|
-
* loader: 'sass-loader',
|
|
935
|
-
* options: {
|
|
936
|
-
* warnRuleAsWarning: false,
|
|
937
|
-
* },
|
|
938
|
-
* },
|
|
939
|
-
* ],
|
|
940
|
-
* },
|
|
941
|
-
* ],
|
|
942
|
-
* },
|
|
943
|
-
* };
|
|
944
|
-
* ```
|
|
945
|
-
*/
|
|
946
|
-
warnRuleAsWarning?: boolean | undefined;
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
declare namespace LoaderOptions {
|
|
950
|
-
type Callback<T> = (content: string | Buffer, loaderContext: Webpack.loader.LoaderContext) => T;
|
|
951
|
-
|
|
952
|
-
type SassOptions = Options | Sass.LegacyOptions<"sync">;
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
declare function loader(content: string): void;
|
|
956
|
-
|
|
957
|
-
declare namespace loader {
|
|
958
|
-
type Options = LoaderOptions;
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
export { loader as default };
|
|
1
|
+
export = any;
|