Skip to content

Commit 0e81dc7

Browse files
committed
[2025-10-26] Sass compile improvements
Details: - Added benchmarkCompileTime option to sass compiler - Added option to compile scss via the CLI
1 parent ca61b15 commit 0e81dc7

Some content is hidden

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

73 files changed

+1294
-492
lines changed

.scripts/classes/Build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export class Build extends BuildStage {
161161
'src/docs/tsconfig.json',
162162
];
163163

164-
await Promise.all( tsPaths.map(
164+
return Promise.all( tsPaths.map(
165165
( tsc ) => {
166166
this.console.verbose( 'checking project: ' + tsc, 2 );
167167
return this.compiler.typescript( tsc, this.params.verbose ? 3 : 2 );

.scripts/classes/Compile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class Compile extends CompileStage {
5656
{ force: true },
5757
);
5858

59-
await this.atry(
59+
return this.atry(
6060
this.fs.prettier,
6161
this.params.verbose ? 3 : 2,
6262
[ jsonDistDir + '/**/*.json', 'json' ],

dist/js/bin/lib/getConfig.js

Lines changed: 13 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/lib/02-utils/classes/Stage_Compiler.d.ts

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
* @maddimathon/build-utilities@0.3.0-alpha.1.draft
88
* @license MIT
99
*/
10+
import { DateTime } from 'luxon';
1011
import * as postcss_PresetEnv from 'postcss-preset-env';
11-
import type { Json } from '@maddimathon/utility-typescript/types';
12+
import * as sass from 'sass';
13+
import type { Json, Objects } from '@maddimathon/utility-typescript/types';
1214
import type { CLI, Config, Stage } from '../../../types/index.js';
1315
import { FileSystem } from '../../00-universal/index.js';
1416
import type { Stage_Console } from './Stage_Console.js';
@@ -154,14 +156,32 @@ export declare class Stage_Compiler implements Stage.Compiler {
154156
*/
155157
readonly postCSS: Stage.Compiler.Args.PostCSS;
156158
readonly sass: {
159+
readonly alertAscii: undefined;
160+
readonly alertColor: undefined;
161+
readonly benchmarkCompileTime: undefined;
157162
readonly charset: true;
163+
readonly cli: undefined;
164+
readonly compileViaCLI: undefined;
165+
readonly fatalDeprecations: undefined;
166+
readonly functions: undefined;
167+
readonly futureDeprecations: undefined;
168+
readonly importers: undefined;
169+
readonly isWatchedUpdate: undefined;
170+
readonly loadPaths: undefined;
171+
readonly logger: undefined;
172+
readonly quietDeps: undefined;
173+
readonly silenceDeprecations: undefined;
158174
readonly sourceMap: true;
159175
readonly sourceMapIncludeSources: true;
160176
readonly style: "expanded";
177+
readonly useAsyncCompiler: false;
178+
readonly verbose: undefined;
161179
};
162180
readonly ts: {};
163181
};
164-
readonly args: Stage.Compiler.Args;
182+
readonly args: Stage.Compiler.Args & {
183+
sass: Objects.Classify<Stage.Compiler.Args.Sass>;
184+
};
165185
/**
166186
* @param config Current project config.
167187
* @param params Current CLI params.
@@ -199,6 +219,48 @@ export declare class Stage_Compiler implements Stage.Compiler {
199219
from: string;
200220
to?: string;
201221
}[], level: number, _postCssOpts?: Stage.Compiler.Args.PostCSS): Promise<void>;
222+
/**
223+
* Creates the message for the benchmark end notice.
224+
*
225+
* @since 0.3.0-alpha.1.draft
226+
*/
227+
protected benchmarkStartTimeMaker(msg: string, start: DateTime): string;
228+
/**
229+
* Creates the message for the benchmark end notice.
230+
*
231+
* @since 0.3.0-alpha.1.draft
232+
*/
233+
protected benchmarkEndTimeMaker(msg: string, start: DateTime, end?: DateTime): string;
234+
/**
235+
* Runs the compiler from the sass package.
236+
*
237+
* @since 0.3.0-alpha.1.draft
238+
*/
239+
protected sassCompiler(input: string, opts: Stage.Compiler.Args.Sass): Promise<{
240+
compiled: sass.CompileResult;
241+
end: DateTime<true>;
242+
}>;
243+
/**
244+
* This skips compiling options and validating values.
245+
*
246+
* @since 0.3.0-alpha.1.draft
247+
*/
248+
protected scssAPI(input: string, output: string, level: number, sassCompleteOpts: Objects.Classify<Stage.Compiler.Args.Sass>): Promise<string>;
249+
/**
250+
* Coverts scss args for the CLI.
251+
*
252+
* @since 0.3.0-alpha.1.draft
253+
*/
254+
protected scssCLI_args(completeSassOpts: Stage.Compiler.Args.Sass): string;
255+
/**
256+
* Compiles scs via CLI. This skips compiling options and validating values.
257+
*
258+
* @since 0.3.0-alpha.1.draft
259+
*/
260+
protected scssCLI(input: string, output: string, level: number, sassCompleteOpts: Objects.Classify<Stage.Compiler.Args.Sass>): Promise<{
261+
compiled: string;
262+
end: DateTime<true>;
263+
}>;
202264
scss(input: string, output: string, level: number, sassOpts?: Stage.Compiler.Args.Sass): Promise<string>;
203265
scssBulk(paths: {
204266
input: string;

0 commit comments

Comments
 (0)