diff --git a/build/base.config.ts b/build/base.config.ts index 5aceeb50..b5207b1e 100644 --- a/build/base.config.ts +++ b/build/base.config.ts @@ -1,4 +1,4 @@ -import { copyFile, mkdir } from 'fs/promises' +import { copyFile, mkdir } from 'node:fs/promises' import { createResolver } from '@nuxt/kit' import { defineBuildConfig } from 'unbuild' diff --git a/build/base.ts b/build/base.ts index 35f439d9..8115f6ee 100644 --- a/build/base.ts +++ b/build/base.ts @@ -1,4 +1,4 @@ -import { resolve } from 'path' +import { resolve } from 'node:path' import { build } from 'unbuild' import baseBuildConfig from './base.config' diff --git a/playground/components/ThemeSelect.vue b/playground/components/ThemeSelect.vue index 7c3c6786..991c0901 100644 --- a/playground/components/ThemeSelect.vue +++ b/playground/components/ThemeSelect.vue @@ -11,7 +11,7 @@ const preference = computed(() => { return 'dark' }) -const toggle = () => { +function toggle() { toggleCount.value++ const cl = document.querySelector('html')?.classList if (cl && cl.contains('dark')) { diff --git a/src/runtime/features/stylesheet.ts b/src/runtime/features/stylesheet.ts index 072495f5..c8a4339f 100644 --- a/src/runtime/features/stylesheet.ts +++ b/src/runtime/features/stylesheet.ts @@ -157,7 +157,7 @@ export function usePinceauRuntimeSheet( function deleteRule(rule: CSSRule) { const ruleIndex = Object.values(sheet.value.cssRules).indexOf(rule) - if (typeof ruleIndex === 'undefined' || isNaN(ruleIndex)) { return } + if (typeof ruleIndex === 'undefined' || Number.isNaN(ruleIndex)) { return } try { sheet.value.deleteRule(ruleIndex) } catch (e) { /* Continue regardless of errors */ } diff --git a/src/runtime/features/variants.ts b/src/runtime/features/variants.ts index e8e55e2a..5e996254 100644 --- a/src/runtime/features/variants.ts +++ b/src/runtime/features/variants.ts @@ -5,14 +5,12 @@ import { computed, onScopeDispose, ref, watch } from 'vue' import type { PinceauRuntimeIds } from '../../types' import type { PinceauRuntimeSheet } from './stylesheet' -export const usePinceauVariants = ( - ids: ComputedRef, +export function usePinceauVariants(ids: ComputedRef, variants: any, props: any, sheet: PinceauRuntimeSheet, classes: Ref, - loc: any, -) => { + loc: any) { let rule: CSSRule = sheet.hydratableRules?.[ids.value.uid]?.v const variantsState = computed(() => variants ? resolveVariantsState(ids.value, props, variants) : {}) const variantsClasses = ref([]) diff --git a/src/theme/formats.ts b/src/theme/formats.ts index 1091b1c3..96dea387 100644 --- a/src/theme/formats.ts +++ b/src/theme/formats.ts @@ -12,7 +12,7 @@ import { resolveThemeRule } from '../utils/css' /** * Stringify utils from object */ -const stringifyUtils = (value: Record, definitions: any) => { +function stringifyUtils(value: Record, definitions: any) { const entries = Object.entries(value) return entries.reduce( (acc, [key, value]) => { @@ -40,7 +40,7 @@ const stringifyUtils = (value: Record, definitions: any) => { /** * Enhance tokens paths list */ -const enhanceTokenPaths = (value = []) => { +function enhanceTokenPaths(value = []) { const tokensLiteralNodes = [] value.forEach(([keyPath]) => { @@ -88,7 +88,7 @@ export function tsFull(tokensObject: any) { /** * import 'pinceau.css' */ -export const cssFull = (dictionary: Dictionary, options: Options, responsiveTokens: any, colorSchemeMode: ColorSchemeModes) => { +export function cssFull(dictionary: Dictionary, options: Options, responsiveTokens: any, colorSchemeMode: ColorSchemeModes) { const { formattedVariables } = StyleDictionary.formatHelpers // Create :root tokens list @@ -140,7 +140,7 @@ export const cssFull = (dictionary: Dictionary, options: Options, responsiveToke /** * definitions.ts */ -export const definitionsFull = (definitions: any) => { +export function definitionsFull(definitions: any) { return `export const definitions = ${JSON.stringify(definitions, null, 2)} as const` } @@ -158,7 +158,7 @@ export function schemaFull(schema: Schema) { /** * import utils from '#pinceau/utils' */ -export const utilsFull = (utils = {}, utilsImports = [], definitions = {}) => { +export function utilsFull(utils = {}, utilsImports = [], definitions = {}) { let result = 'import { PinceauTheme, PropertyValue } from \'pinceau\'\n' // Add utilsImports from config diff --git a/src/theme/layers.ts b/src/theme/layers.ts index fe4dd643..162fe3fd 100644 --- a/src/theme/layers.ts +++ b/src/theme/layers.ts @@ -1,5 +1,5 @@ -import { existsSync } from 'fs' -import { readFile } from 'fs/promises' +import { existsSync } from 'node:fs' +import { readFile } from 'node:fs/promises' import createJITI from 'jiti' import { resolve } from 'pathe' import type { ConfigFileImport, ConfigLayer, LoadConfigResult, PinceauOptions, PinceauTheme, ResolvedConfigLayer } from '../types' diff --git a/src/theme/output.ts b/src/theme/output.ts index cd559499..1f8c5ca7 100644 --- a/src/theme/output.ts +++ b/src/theme/output.ts @@ -1,5 +1,5 @@ -import { existsSync } from 'fs' -import { mkdir, rm, writeFile } from 'fs/promises' +import { existsSync } from 'node:fs' +import { mkdir, rm, writeFile } from 'node:fs/promises' import { join } from 'pathe' import type { PinceauOptions } from '../types' import { schemaFull, tsFull, utilsFull } from './formats' diff --git a/src/transforms/css.ts b/src/transforms/css.ts index f09f96e2..b23baafa 100644 --- a/src/transforms/css.ts +++ b/src/transforms/css.ts @@ -10,15 +10,13 @@ import { resolveRuntimeContents } from './vue/computed' /** * Stringify every call of css() into a valid Vue