diff --git a/eslint.config.js b/eslint.config.js index 2dc5c91..4ed9ac4 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,4 +1,17 @@ import loguxConfig from '@logux/eslint-config' /** @type {import('eslint').Linter.Config[]} */ -export default [{ ignores: ['dist/', 'design/'] }, ...loguxConfig] +export default [ + { ignores: ['dist/', 'design/'] }, + ...loguxConfig, + { + rules: { + 'n/no-unsupported-features/node-builtins': [ + 'error', + { + ignores: ['fs.globSync'] + } + ] + } + } +] diff --git a/package.json b/package.json index 2b212de..8861536 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,6 @@ "dependencies": { "@types/node": "^22.7.4", "autoprefixer": "^10.4.20", - "globby": "^14.0.2", "jstransformer-lowlight": "^0.1.0", "postcss": "^8.4.47", "postcss-hexrgba": "^2.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 211fe52..69606fb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,9 +14,6 @@ importers: autoprefixer: specifier: ^10.4.20 version: 10.4.20(postcss@8.4.47) - globby: - specifier: ^14.0.2 - version: 14.0.2 jstransformer-lowlight: specifier: ^0.1.0 version: 0.1.0 @@ -455,10 +452,6 @@ packages: '@rtsao/scc@1.1.0': resolution: {integrity: sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==} - '@sindresorhus/merge-streams@2.3.0': - resolution: {integrity: sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==} - engines: {node: '>=18'} - '@size-limit/file@11.1.6': resolution: {integrity: sha512-ojzzJMrTfcSECRnaTjGy0wNIolTCRdyqZTSWG9sG5XEoXG6PNgHXDDS6gf6YNxnqb+rWfCfVe93u6aKi3wEocQ==} engines: {node: ^18.0.0 || >=20.0.0} @@ -1308,10 +1301,6 @@ packages: resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} engines: {node: '>=10'} - globby@14.0.2: - resolution: {integrity: sha512-s3Fq41ZVh7vbbe2PN3nrW7yC7U7MFVc5c98/iTl9c2GawNMKx/J648KQRW6WKkuU8GIbbh2IXfIRQjOZnXcTnw==} - engines: {node: '>=18'} - globjoin@0.1.4: resolution: {integrity: sha512-xYfnw62CKG8nLkZBfWbhWwDw02CHty86jfPcc2cr3ZfeuK9ysoVPPEUxf21bAD/rWAgk52SuBrLJlefNy8mvFg==} @@ -1965,10 +1954,6 @@ packages: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} - path-type@5.0.0: - resolution: {integrity: sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==} - engines: {node: '>=12'} - picocolors@1.1.0: resolution: {integrity: sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==} @@ -2245,10 +2230,6 @@ packages: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} - slash@5.1.0: - resolution: {integrity: sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==} - engines: {node: '>=14.16'} - slice-ansi@4.0.0: resolution: {integrity: sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==} engines: {node: '>=10'} @@ -2461,10 +2442,6 @@ packages: undici-types@6.19.8: resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} - unicorn-magic@0.1.0: - resolution: {integrity: sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==} - engines: {node: '>=18'} - unified@11.0.5: resolution: {integrity: sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==} @@ -2862,8 +2839,6 @@ snapshots: '@rtsao/scc@1.1.0': {} - '@sindresorhus/merge-streams@2.3.0': {} - '@size-limit/file@11.1.6(size-limit@11.1.6)': dependencies: size-limit: 11.1.6 @@ -3847,15 +3822,6 @@ snapshots: merge2: 1.4.1 slash: 3.0.0 - globby@14.0.2: - dependencies: - '@sindresorhus/merge-streams': 2.3.0 - fast-glob: 3.3.2 - ignore: 5.3.2 - path-type: 5.0.0 - slash: 5.1.0 - unicorn-magic: 0.1.0 - globjoin@0.1.4: {} gopd@1.0.1: @@ -4673,8 +4639,6 @@ snapshots: path-type@4.0.0: {} - path-type@5.0.0: {} - picocolors@1.1.0: {} picomatch@2.3.1: {} @@ -5042,8 +5006,6 @@ snapshots: slash@3.0.0: {} - slash@5.1.0: {} - slice-ansi@4.0.0: dependencies: ansi-styles: 4.3.0 @@ -5321,8 +5283,6 @@ snapshots: undici-types@6.19.8: {} - unicorn-magic@0.1.0: {} - unified@11.0.5: dependencies: '@types/unist': 3.0.3 diff --git a/scripts/build-api.js b/scripts/build-api.js index 4b3188f..e3d81a5 100755 --- a/scripts/build-api.js +++ b/scripts/build-api.js @@ -1,7 +1,6 @@ #!/usr/bin/env node -import { globby } from 'globby' import childProcess from 'node:child_process' -import { existsSync } from 'node:fs' +import { existsSync, globSync } from 'node:fs' import { mkdir, rm, writeFile } from 'node:fs/promises' import { join } from 'node:path' import { promisify } from 'node:util' @@ -67,17 +66,14 @@ async function downloadProject(name) { } async function readTypedoc() { - let files = await globby('lib/*.d.ts', { - absolute: true, - cwd: join(PROJECTS, 'postcss') - }) + let files = globSync(join(PROJECTS, 'postcss/lib/*.d.ts')) let app = new TypeDoc.Application() app.bootstrap({ - entryPoints: files.flat(), + entryPoints: files, tsconfig: join(PROJECTS, 'postcss', 'tsconfig.json') }) - app.options.setCompilerOptions(files.flat(), { + app.options.setCompilerOptions(files, { esModuleInterop: true }) @@ -281,7 +277,10 @@ function typeString(type) { '{ ' + decl.children .map(i => { - if (i.kind === ReflectionKind.Function || i.kind === ReflectionKind.Method) { + if ( + i.kind === ReflectionKind.Function || + i.kind === ReflectionKind.Method + ) { return i.name + ': ' + functionString(i) } else { return i.name + ': ' + typeString(i.type) @@ -303,7 +302,7 @@ function typeHtml(nodes, type) { .replace(/<>/g, '') .replace( 'DeclarationProps | Declaration | AtRule | Rule | Comment | AtRuleProps' + - ' | RuleProps | CommentProps', + ' | RuleProps | CommentProps', 'ChildProps | ChildNode' ) .replace( @@ -458,9 +457,13 @@ function generateBody(nodes) { let children = type.children || [] if (name === 'postcss' && node.kind === ReflectionKind.Namespace) { children = node.children - } else if (!node.signatures?.length && !node.comment && !node.children?.length) { - type = node.tryGetTargetReflection(); - children = type.children || []; + } else if ( + !node.signatures?.length && + !node.comment && + !node.children?.length + ) { + type = node.tryGetTargetReflection() + children = type.children || [] if (!children.length) return '' } else if (name !== 'postcss' && node.kind === ReflectionKind.Namespace) { return '' diff --git a/scripts/build-docs.js b/scripts/build-docs.js index 4038764..116b10b 100755 --- a/scripts/build-docs.js +++ b/scripts/build-docs.js @@ -1,7 +1,6 @@ #!/usr/bin/env node -import { globby } from 'globby' import childProcess from 'node:child_process' -import { existsSync } from 'node:fs' +import { existsSync, globSync } from 'node:fs' import { mkdir, readFile, rm, writeFile } from 'node:fs/promises' import { join } from 'node:path' import { promisify } from 'node:util' @@ -13,7 +12,7 @@ import remarkRehype from 'remark-rehype' import { unified } from 'unified' import { build } from 'vite' -import { DIST, PROJECTS, ROOT, SRC } from './lib/dir.js' +import { DIST, PROJECTS, SRC } from './lib/dir.js' let exec = promisify(childProcess.exec) @@ -94,12 +93,12 @@ const IGNORE_FILES = [ ] async function readDocs() { - let files = await globby(join(PROJECTS, 'postcss/docs/**/*.md')) + let files = globSync(join(PROJECTS, 'postcss/docs/**/*.md')) let docs = await Promise.all( files .filter(file => !IGNORE_FILES.includes(file)) .map(async file => { - let md = await readFile(join(ROOT, file)) + let md = await readFile(file) let tree = await unified()().use(remarkParse).parse(md) tree = await unified() .use(remarkRehype, { allowDangerousHtml: true })