@najemi-software/typed-scss-modules 13.5.0 → 13.6.0

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/README.md CHANGED
@@ -367,7 +367,7 @@ In addition to all CLI options, the following are options only available with th
367
367
 
368
368
  Define a [single custom SASS importer or an array of SASS importers](https://github.com/sass/sass/blob/f355f602fc15f55b0a0a795ebe6eb819963e08a5/js-api-doc/legacy/importer.d.ts#L51-L149). This should only be necessary if custom SASS importers are already being used in the build process. This is used internally to implement `aliases` and `aliasPrefixes`.
369
369
 
370
- Refer to [`lib/sass/importer.ts`](/blob/master/lib/sass/importer.ts) for more details and `sass` importer type definitions.
370
+ Refer to [`src/sass/importer.ts`](/blob/master/src/sass/importer.ts) for more details and `sass` importer type definitions.
371
371
 
372
372
  ### `silenceDeprecations`
373
373
 
package/esm/cli.js CHANGED
@@ -119,5 +119,4 @@ const { _: patterns, ...rest } = yargs(hideBin(process.argv))
119
119
  describe: 'Output filenames that will be compatible with the "arbitrary file extensions" feature that was introduced in TypeScript 5.0.',
120
120
  })
121
121
  .parseSync();
122
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
123
122
  main(patterns[0], { ...rest });
@@ -14,7 +14,7 @@ export const listDifferent = async (pattern, options) => {
14
14
  export const checkFile = async (file, options) => {
15
15
  try {
16
16
  const classNames = await fileToClassNames(file, options);
17
- const typeDefinition = await classNamesToTypeDefinitions({
17
+ const typeDefinition = classNamesToTypeDefinitions({
18
18
  classNames: classNames,
19
19
  file,
20
20
  ...options,
package/esm/core/watch.js CHANGED
@@ -19,12 +19,10 @@ export const watch = (pattern, options) => {
19
19
  watcher
20
20
  .on("change", (path) => {
21
21
  alerts.info(`[CHANGED] ${path}`);
22
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
23
22
  writeFile(path, options);
24
23
  })
25
24
  .on("add", (path) => {
26
25
  alerts.info(`[ADDED] ${path}`);
27
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
28
26
  writeFile(path, options);
29
27
  })
30
28
  .on("unlink", (path) => {
@@ -13,7 +13,7 @@ import { removeSCSSTypeDefinitionFile } from "./remove-file.js";
13
13
  export const writeFile = async (file, options) => {
14
14
  try {
15
15
  const classNames = await fileToClassNames(file, options);
16
- const typeDefinition = await classNamesToTypeDefinitions({
16
+ const typeDefinition = classNamesToTypeDefinitions({
17
17
  classNames,
18
18
  file,
19
19
  ...options,
@@ -19,12 +19,12 @@ export const getDefaultImplementation = (resolver) => {
19
19
  try {
20
20
  resolver ? resolver("sass") : import("sass");
21
21
  }
22
- catch (error) {
22
+ catch {
23
23
  try {
24
24
  resolver ? resolver("sass-embedded") : import("sass-embedded");
25
25
  pkg = "sass-embedded";
26
26
  }
27
- catch (ignoreError) {
27
+ catch {
28
28
  pkg = "sass";
29
29
  }
30
30
  }
@@ -44,11 +44,9 @@ export const getImplementationAsync = (
44
44
  // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
45
45
  implementation = "sass") => {
46
46
  if (implementation === "sass") {
47
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
48
47
  return import("sass");
49
48
  }
50
49
  if (implementation === "sass-embedded") {
51
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
52
50
  return import("sass-embedded");
53
51
  }
54
52
  throw new Error(`'${implementation}' Implementation is not supported`);
package/esm/load.js CHANGED
@@ -31,9 +31,7 @@ export const loadConfig = async () => {
31
31
  return configModule.mod.config || configModule.mod.default || configModule.mod;
32
32
  }
33
33
  catch (error) {
34
- alerts.error(
35
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
36
- `An error occurred loading the config file "${configPath}":\n${error}`);
34
+ alerts.error(`An error occurred loading the config file "${configPath}":\n${error}`);
37
35
  return {};
38
36
  }
39
37
  }
package/esm/main.js CHANGED
@@ -23,6 +23,7 @@ export const main = async (pattern, cliOptions) => {
23
23
  options.loadPaths = [pattern];
24
24
  }
25
25
  // When the pattern provide is a directory, assume all .scss files within.
26
+ // eslint-disable-next-line no-param-reassign
26
27
  pattern = slash(path.resolve(pattern, "**/*.scss"));
27
28
  }
28
29
  if (options.listDifferent) {
@@ -17,11 +17,18 @@ export const nameFormatDefault = "camel";
17
17
  export const fileToClassNames = async (file, { style = "expanded", loadPaths = [], silenceDeprecations = [], nameFormat: rawNameFormat, implementation, aliases, aliasPrefixes, importers = [], async = false, } = {}) => {
18
18
  const root = await getImplementation(implementation);
19
19
  const nameFormat = (typeof rawNameFormat === "string" ? [rawNameFormat] : rawNameFormat);
20
- const nameFormats = nameFormat
21
- ? nameFormat.includes("all")
22
- ? NAME_FORMATS_WITH_TRANSFORMER
23
- : nameFormat
24
- : [nameFormatDefault];
20
+ let nameFormats = [];
21
+ if (nameFormat) {
22
+ if (nameFormat.includes("all")) {
23
+ nameFormats = NAME_FORMATS_WITH_TRANSFORMER;
24
+ }
25
+ else {
26
+ nameFormats = nameFormat;
27
+ }
28
+ }
29
+ else {
30
+ nameFormats = [nameFormatDefault];
31
+ }
25
32
  const result = !async
26
33
  ? getSyncCompiler({ implementation, root }).compile(file, {
27
34
  style,
@@ -23,4 +23,4 @@ export declare const exportTypeNameDefault: string;
23
23
  export declare const exportTypeInterfaceDefault: string;
24
24
  export declare const quoteTypeDefault: QuoteType;
25
25
  export declare const bannerTypeDefault: string;
26
- export declare const classNamesToTypeDefinitions: (options: TypeDefinitionOptions) => Promise<string | null>;
26
+ export declare const classNamesToTypeDefinitions: (options: TypeDefinitionOptions) => string | null;
@@ -25,7 +25,7 @@ const isValidName = (className) => {
25
25
  }
26
26
  return true;
27
27
  };
28
- export const classNamesToTypeDefinitions = async (options) => {
28
+ export const classNamesToTypeDefinitions = (options) => {
29
29
  if (options.classNames.length) {
30
30
  const lines = [];
31
31
  const { exportTypeName: ClassNames = exportTypeNameDefault, exportTypeInterface: Styles = exportTypeInterfaceDefault, } = options;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@najemi-software/typed-scss-modules",
3
- "version": "13.5.0",
3
+ "version": "13.6.0",
4
4
  "private": false,
5
5
  "description": "TypeScript type definition generator for SCSS CSS Modules",
6
6
  "keywords": [