Skip to content

Commit a72459f

Browse files
Bump gts from 5.3.1 to 6.0.2 (#345)
* Bump gts from 5.3.1 to 6.0.2 Bumps [gts](https://github.com/google/gts) from 5.3.1 to 6.0.2. - [Release notes](https://github.com/google/gts/releases) - [Changelog](https://github.com/google/gts/blob/main/CHANGELOG.md) - [Commits](google/gts@v5.3.1...v6.0.2) --- updated-dependencies: - dependency-name: gts dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * run "npm run fix" with gts v6 Fixes needed because `gts` turned on `composite: true`: * Add package.json to tsconfig. The file is referenced by TS files. * Add a declarationDir `_types`. This directory is ignored. This is necessary because we can't omit `declarations`. --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Carlos (Goodwine) <[email protected]>
1 parent 350cbc9 commit a72459f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+313
-308
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.DS_Store
2+
_types
23
build
34
dist
45
lib/src/vendor

bin/sass.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ try {
1414
{
1515
stdio: 'inherit',
1616
windowsHide: true,
17-
}
17+
},
1818
);
1919
} catch (error) {
2020
if (error.code) {

lib/src/compile.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export {NodePackageImporter} from './importer-registry';
1111

1212
export function compile(
1313
path: string,
14-
options?: OptionsWithLegacy<'sync'>
14+
options?: OptionsWithLegacy<'sync'>,
1515
): CompileResult {
1616
const compiler = initCompiler();
1717
try {
@@ -23,7 +23,7 @@ export function compile(
2323

2424
export function compileString(
2525
source: string,
26-
options?: StringOptionsWithLegacy<'sync'>
26+
options?: StringOptionsWithLegacy<'sync'>,
2727
): CompileResult {
2828
const compiler = initCompiler();
2929
try {
@@ -35,7 +35,7 @@ export function compileString(
3535

3636
export async function compileAsync(
3737
path: string,
38-
options?: OptionsWithLegacy<'async'>
38+
options?: OptionsWithLegacy<'async'>,
3939
): Promise<CompileResult> {
4040
const compiler = await initAsyncCompiler();
4141
try {
@@ -47,7 +47,7 @@ export async function compileAsync(
4747

4848
export async function compileStringAsync(
4949
source: string,
50-
options?: StringOptionsWithLegacy<'async'>
50+
options?: StringOptionsWithLegacy<'async'>,
5151
): Promise<CompileResult> {
5252
const compiler = await initAsyncCompiler();
5353
try {

lib/src/compiler-path.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function isLinuxMusl(path: string): boolean {
1717
return p.basename(interpreter).startsWith('ld-musl-');
1818
} catch (error) {
1919
console.warn(
20-
`Warning: Failed to detect linux-musl, fallback to linux-gnu: ${error.message}`
20+
`Warning: Failed to detect linux-musl, fallback to linux-gnu: ${error.message}`,
2121
);
2222
return false;
2323
}
@@ -37,7 +37,7 @@ export const compilerCommand = (() => {
3737
const executable = p.resolve(
3838
__dirname,
3939
path,
40-
`dart-sass/sass${platform === 'win32' ? '.bat' : ''}`
40+
`dart-sass/sass${platform === 'win32' ? '.bat' : ''}`,
4141
);
4242

4343
if (fs.existsSync(executable)) return [executable];
@@ -47,10 +47,10 @@ export const compilerCommand = (() => {
4747
return [
4848
require.resolve(
4949
`sass-embedded-${platform}-${arch}/dart-sass/src/dart` +
50-
(platform === 'win32' ? '.exe' : '')
50+
(platform === 'win32' ? '.exe' : ''),
5151
),
5252
require.resolve(
53-
`sass-embedded-${platform}-${arch}/dart-sass/src/sass.snapshot`
53+
`sass-embedded-${platform}-${arch}/dart-sass/src/sass.snapshot`,
5454
),
5555
];
5656
} catch (ignored) {
@@ -61,7 +61,7 @@ export const compilerCommand = (() => {
6161
return [
6262
require.resolve(
6363
`sass-embedded-${platform}-${arch}/dart-sass/sass` +
64-
(platform === 'win32' ? '.bat' : '')
64+
(platform === 'win32' ? '.bat' : ''),
6565
),
6666
];
6767
} catch (e: unknown) {
@@ -74,6 +74,6 @@ export const compilerCommand = (() => {
7474
"Embedded Dart Sass couldn't find the embedded compiler executable. " +
7575
'Please make sure the optional dependency ' +
7676
`sass-embedded-${platform}-${arch} is installed in ` +
77-
'node_modules.'
77+
'node_modules.',
7878
);
7979
})();

lib/src/compiler.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ describe('asyncCompiler', () => {
110110
describe('compilation ID', () => {
111111
it('resets after concurrent compilations complete', async () => {
112112
await Promise.all(
113-
Array.from({length: 10}, () => asyncCompiler.compileStringAsync(''))
113+
Array.from({length: 10}, () => asyncCompiler.compileStringAsync('')),
114114
);
115115
await asyncCompiler.compileStringAsync('');
116116
expect(getIdHistory()).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1]);
117117
});
118118

119119
it('keeps working after failed compilations', async () => {
120120
await expect(
121-
asyncCompiler.compileStringAsync('invalid')
121+
asyncCompiler.compileStringAsync('invalid'),
122122
).rejects.toThrow();
123123
await Promise.all([
124124
asyncCompiler.compileStringAsync(''),

lib/src/compiler/async.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ export class AsyncCompiler {
4646
cwd: path.dirname(compilerCommand[0]),
4747
// Node blocks launching .bat and .cmd without a shell due to CVE-2024-27980
4848
shell: ['.bat', '.cmd'].includes(
49-
path.extname(compilerCommand[0]).toLowerCase()
49+
path.extname(compilerCommand[0]).toLowerCase(),
5050
),
5151
windowsHide: true,
52-
}
52+
},
5353
);
5454

5555
/** The next compilation ID. */
@@ -101,7 +101,7 @@ export class AsyncCompiler {
101101
private async compileRequestAsync(
102102
request: proto.InboundMessage_CompileRequest,
103103
importers: ImporterRegistry<'async'>,
104-
options?: OptionsWithLegacy<'async'> & {legacy?: boolean}
104+
options?: OptionsWithLegacy<'async'> & {legacy?: boolean},
105105
): Promise<CompileResult> {
106106
const optionsKey = Symbol();
107107
activeDeprecationOptions.set(optionsKey, options ?? {});
@@ -116,7 +116,7 @@ export class AsyncCompiler {
116116
handleFileImportRequest: request => importers.fileImport(request),
117117
handleCanonicalizeRequest: request => importers.canonicalize(request),
118118
handleFunctionCallRequest: request => functions.call(request),
119-
}
119+
},
120120
);
121121
dispatcher.logEvents$.subscribe(event => handleLogEvent(options, event));
122122

@@ -133,7 +133,7 @@ export class AsyncCompiler {
133133
} else {
134134
resolve(response!);
135135
}
136-
})
136+
}),
137137
);
138138
this.compilations.add(compilation);
139139

@@ -148,7 +148,7 @@ export class AsyncCompiler {
148148
if (flag !== initFlag) {
149149
throw utils.compilerError(
150150
'AsyncCompiler can not be directly constructed. ' +
151-
'Please use `sass.initAsyncCompiler()` instead.'
151+
'Please use `sass.initAsyncCompiler()` instead.',
152152
);
153153
}
154154
this.stderr$.subscribe(data => process.stderr.write(data));
@@ -157,33 +157,33 @@ export class AsyncCompiler {
157157
});
158158
this.messageTransformer = new MessageTransformer(
159159
packetTransformer.outboundProtobufs$,
160-
packet => packetTransformer.writeInboundProtobuf(packet)
160+
packet => packetTransformer.writeInboundProtobuf(packet),
161161
);
162162
}
163163

164164
compileAsync(
165165
path: string,
166-
options?: OptionsWithLegacy<'async'>
166+
options?: OptionsWithLegacy<'async'>,
167167
): Promise<CompileResult> {
168168
this.throwIfDisposed();
169169
const importers = new ImporterRegistry(options);
170170
return this.compileRequestAsync(
171171
newCompilePathRequest(path, importers, options),
172172
importers,
173-
options
173+
options,
174174
);
175175
}
176176

177177
compileStringAsync(
178178
source: string,
179-
options?: StringOptionsWithLegacy<'async'>
179+
options?: StringOptionsWithLegacy<'async'>,
180180
): Promise<CompileResult> {
181181
this.throwIfDisposed();
182182
const importers = new ImporterRegistry(options);
183183
return this.compileRequestAsync(
184184
newCompileStringRequest(source, importers, options),
185185
importers,
186-
options
186+
options,
187187
);
188188
}
189189

lib/src/compiler/sync.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ export class Compiler {
4646
cwd: path.dirname(compilerCommand[0]),
4747
// Node blocks launching .bat and .cmd without a shell due to CVE-2024-27980
4848
shell: ['.bat', '.cmd'].includes(
49-
path.extname(compilerCommand[0]).toLowerCase()
49+
path.extname(compilerCommand[0]).toLowerCase(),
5050
),
5151
windowsHide: true,
52-
}
52+
},
5353
);
5454

5555
/** The next compilation ID. */
@@ -107,7 +107,7 @@ export class Compiler {
107107
private compileRequestSync(
108108
request: proto.InboundMessage_CompileRequest,
109109
importers: ImporterRegistry<'sync'>,
110-
options?: OptionsWithLegacy<'sync'>
110+
options?: OptionsWithLegacy<'sync'>,
111111
): CompileResult {
112112
const optionsKey = Symbol();
113113
activeDeprecationOptions.set(optionsKey, options ?? {});
@@ -122,7 +122,7 @@ export class Compiler {
122122
handleFileImportRequest: request => importers.fileImport(request),
123123
handleCanonicalizeRequest: request => importers.canonicalize(request),
124124
handleFunctionCallRequest: request => functions.call(request),
125-
}
125+
},
126126
);
127127
this.dispatchers.add(dispatcher);
128128

@@ -168,7 +168,7 @@ export class Compiler {
168168
if (flag !== initFlag) {
169169
throw utils.compilerError(
170170
'Compiler can not be directly constructed. ' +
171-
'Please use `sass.initAsyncCompiler()` instead.'
171+
'Please use `sass.initAsyncCompiler()` instead.',
172172
);
173173
}
174174
this.stderr$.subscribe(data => process.stderr.write(data));
@@ -177,7 +177,7 @@ export class Compiler {
177177
});
178178
this.messageTransformer = new MessageTransformer(
179179
packetTransformer.outboundProtobufs$,
180-
packet => packetTransformer.writeInboundProtobuf(packet)
180+
packet => packetTransformer.writeInboundProtobuf(packet),
181181
);
182182
}
183183

@@ -187,7 +187,7 @@ export class Compiler {
187187
return this.compileRequestSync(
188188
newCompilePathRequest(path, importers, options),
189189
importers,
190-
options
190+
options,
191191
);
192192
}
193193

@@ -197,7 +197,7 @@ export class Compiler {
197197
return this.compileRequestSync(
198198
newCompileStringRequest(source, importers, options),
199199
importers,
200-
options
200+
options,
201201
);
202202
}
203203

lib/src/compiler/utils.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,21 @@ export type StringOptionsWithLegacy<sync extends 'sync' | 'async'> =
5151
export function createDispatcher<sync extends 'sync' | 'async'>(
5252
compilationId: number,
5353
messageTransformer: MessageTransformer,
54-
handlers: DispatcherHandlers<sync>
54+
handlers: DispatcherHandlers<sync>,
5555
): Dispatcher<sync> {
5656
return new Dispatcher<sync>(
5757
compilationId,
5858
messageTransformer.outboundMessages$,
5959
message => messageTransformer.writeInboundMessage(message),
60-
handlers
60+
handlers,
6161
);
6262
}
6363

6464
// Creates a compilation request for the given `options` without adding any
6565
// input-specific options.
6666
function newCompileRequest(
6767
importers: ImporterRegistry<'sync' | 'async'>,
68-
options?: Options<'sync' | 'async'>
68+
options?: Options<'sync' | 'async'>,
6969
): proto.InboundMessage_CompileRequest {
7070
const request = create(proto.InboundMessage_CompileRequestSchema, {
7171
importers: importers.importers,
@@ -103,7 +103,7 @@ function newCompileRequest(
103103
export function newCompilePathRequest(
104104
path: string,
105105
importers: ImporterRegistry<'sync' | 'async'>,
106-
options?: Options<'sync' | 'async'>
106+
options?: Options<'sync' | 'async'>,
107107
): proto.InboundMessage_CompileRequest {
108108
const absPath = p.resolve(path);
109109
const request = newCompileRequest(importers, options);
@@ -115,7 +115,7 @@ export function newCompilePathRequest(
115115
export function newCompileStringRequest(
116116
source: string,
117117
importers: ImporterRegistry<'sync' | 'async'>,
118-
options?: StringOptions<'sync' | 'async'>
118+
options?: StringOptions<'sync' | 'async'>,
119119
): proto.InboundMessage_CompileRequest {
120120
const input = create(proto.InboundMessage_CompileRequest_StringInputSchema, {
121121
source,
@@ -134,7 +134,7 @@ export function newCompileStringRequest(
134134
proto.InboundMessage_CompileRequest_ImporterSchema,
135135
{
136136
importer: {case: 'path', value: p.resolve('.')},
137-
}
137+
},
138138
);
139139
} else {
140140
// When importer is not set on the host, the compiler will set a
@@ -148,15 +148,15 @@ export function newCompileStringRequest(
148148

149149
/** Type guard to check that `id` is a valid deprecation ID. */
150150
function validDeprecationId(
151-
id: string | number | symbol | undefined
151+
id: string | number | symbol | undefined,
152152
): id is keyof typeof deprecations {
153153
return !!id && id in deprecations;
154154
}
155155

156156
/** Handles a log event according to `options`. */
157157
export function handleLogEvent(
158158
options: OptionsWithLegacy<'sync' | 'async'> | undefined,
159-
event: proto.OutboundMessage_LogEvent
159+
event: proto.OutboundMessage_LogEvent,
160160
): void {
161161
let span = event.span ? deprotofySourceSpan(event.span) : null;
162162
if (span && options?.legacy) span = removeLegacyImporterFromSpan(span);
@@ -210,7 +210,7 @@ export function handleLogEvent(
210210
* Throws a `SassException` if the compilation failed.
211211
*/
212212
export function handleCompileResponse(
213-
response: proto.OutboundMessage_CompileResponse
213+
response: proto.OutboundMessage_CompileResponse,
214214
): CompileResult {
215215
if (response.result.case === 'success') {
216216
const success = response.result.value;

0 commit comments

Comments
 (0)