@hyperfrontend/project-scope 0.2.1 → 0.2.3
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/CHANGELOG.md +14 -1
- package/README.md +3 -4
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/array/index.cjs.js +7 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/array/index.esm.js +5 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/console/index.cjs.js +13 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/console/index.esm.js +8 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/date/index.cjs.js +10 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/date/index.esm.js +8 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.cjs.js +6 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.esm.js +5 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/json/index.cjs.js +7 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/json/index.esm.js +5 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/map/index.cjs.js +6 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/map/index.esm.js +5 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.cjs.js +9 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.esm.js +6 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/number/index.cjs.js +7 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/number/index.esm.js +7 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/object/index.cjs.js +15 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/object/index.esm.js +9 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.cjs.js +6 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.esm.js +5 -0
- package/_dependencies/@hyperfrontend/logging/index.cjs.js +191 -0
- package/_dependencies/@hyperfrontend/logging/index.d.ts +151 -0
- package/_dependencies/@hyperfrontend/logging/index.esm.js +186 -0
- package/_shared/core/cache/index.cjs.js +135 -0
- package/_shared/core/cache/index.esm.js +128 -0
- package/_shared/core/errors/structured-errors/index.cjs.js +28 -0
- package/_shared/core/errors/structured-errors/index.esm.js +23 -0
- package/_shared/core/fs/guard/index.cjs.js +7 -0
- package/_shared/core/fs/guard/index.esm.js +5 -0
- package/_shared/core/fs/stat/index.cjs.js +47 -0
- package/_shared/core/fs/stat/index.esm.js +41 -0
- package/_shared/core/path/confine/index.cjs.js +22 -0
- package/_shared/core/path/confine/index.esm.js +19 -0
- package/_shared/core/path/join/index.cjs.js +13 -0
- package/_shared/core/path/join/index.esm.js +10 -0
- package/_shared/core/path/normalize/index.cjs.js +37 -0
- package/_shared/core/path/normalize/index.esm.js +31 -0
- package/_shared/core/path/resolve/index.cjs.js +47 -0
- package/_shared/core/path/resolve/index.esm.js +41 -0
- package/_shared/core/path/segments/index.cjs.js +38 -0
- package/_shared/core/path/segments/index.esm.js +31 -0
- package/_shared/core/patterns/glob/index.cjs.js +145 -0
- package/_shared/core/patterns/glob/index.esm.js +136 -0
- package/_shared/core/platform/detect/index.cjs.js +103 -0
- package/_shared/core/platform/detect/index.esm.js +95 -0
- package/_shared/core/platform/line-endings/index.cjs.js +52 -0
- package/_shared/core/platform/line-endings/index.esm.js +44 -0
- package/_shared/project/config/patterns/index.cjs.js +172 -0
- package/_shared/project/config/patterns/index.esm.js +169 -0
- package/_shared/tech/monorepo/pnpm-workspaces/index.cjs.js +33 -0
- package/_shared/tech/monorepo/pnpm-workspaces/index.esm.js +31 -0
- package/_shared/tech/shared-utils/detector-helpers/index.cjs.js +48 -0
- package/_shared/tech/shared-utils/detector-helpers/index.esm.js +43 -0
- package/_shared/vfs/types/index.cjs.js +14 -0
- package/_shared/vfs/types/index.esm.js +12 -0
- package/cli/index.cjs.js +1706 -1910
- package/cli/index.d.ts +273 -7
- package/cli/index.d.ts.map +1 -1
- package/cli/index.esm.js +1593 -1797
- package/core/encoding/index.cjs.js +86 -401
- package/core/encoding/index.d.ts +186 -3
- package/core/encoding/index.d.ts.map +1 -1
- package/core/encoding/index.esm.js +78 -392
- package/core/fs/index.cjs.js +243 -583
- package/core/fs/index.d.ts +479 -6
- package/core/fs/index.d.ts.map +1 -1
- package/core/fs/index.esm.js +233 -573
- package/core/index.cjs.js +526 -1746
- package/core/index.d.ts +486 -9
- package/core/index.d.ts.map +1 -1
- package/core/index.esm.js +515 -1732
- package/core/path/index.cjs.js +8 -234
- package/core/path/index.d.ts +327 -5
- package/core/path/index.d.ts.map +1 -1
- package/core/path/index.esm.js +8 -235
- package/core/platform/index.cjs.js +5 -216
- package/core/platform/index.d.ts +185 -3
- package/core/platform/index.d.ts.map +1 -1
- package/core/platform/index.esm.js +3 -212
- package/heuristics/dependencies/index.cjs.js +105 -493
- package/heuristics/dependencies/index.d.ts +99 -2
- package/heuristics/dependencies/index.d.ts.map +1 -1
- package/heuristics/dependencies/index.esm.js +81 -469
- package/heuristics/entry-points/index.cjs.js +93 -796
- package/heuristics/entry-points/index.d.ts +123 -2
- package/heuristics/entry-points/index.d.ts.map +1 -1
- package/heuristics/entry-points/index.esm.js +74 -777
- package/heuristics/framework/index.cjs.js +1483 -1411
- package/heuristics/framework/index.d.ts +104 -2
- package/heuristics/framework/index.d.ts.map +1 -1
- package/heuristics/framework/index.esm.js +1419 -1347
- package/heuristics/index.cjs.js +3220 -3306
- package/heuristics/index.d.ts +4 -5
- package/heuristics/index.d.ts.map +1 -1
- package/heuristics/index.esm.js +3244 -3330
- package/heuristics/project-type/index.cjs.js +1489 -1438
- package/heuristics/project-type/index.d.ts +64 -2
- package/heuristics/project-type/index.d.ts.map +1 -1
- package/heuristics/project-type/index.esm.js +1419 -1368
- package/index.cjs.js +3058 -3532
- package/index.d.ts +44 -10
- package/index.d.ts.map +1 -1
- package/index.esm.js +2914 -3376
- package/models/index.cjs.js +0 -1
- package/models/index.d.ts +20 -14
- package/models/index.d.ts.map +1 -1
- package/models/index.esm.js +0 -1
- package/nx/index.cjs.js +166 -579
- package/nx/index.d.ts +279 -4
- package/nx/index.d.ts.map +1 -1
- package/nx/index.esm.js +148 -556
- package/package.json +13 -12
- package/project/config/index.cjs.js +127 -1063
- package/project/config/index.d.ts +202 -4
- package/project/config/index.d.ts.map +1 -1
- package/project/config/index.esm.js +110 -1044
- package/project/index.cjs.js +328 -1101
- package/project/index.d.ts +4 -5
- package/project/index.d.ts.map +1 -1
- package/project/index.esm.js +307 -1077
- package/project/package/index.cjs.js +196 -473
- package/project/package/index.d.ts +280 -3
- package/project/package/index.d.ts.map +1 -1
- package/project/package/index.esm.js +183 -459
- package/project/root/index.cjs.js +109 -417
- package/project/root/index.d.ts +83 -2
- package/project/root/index.d.ts.map +1 -1
- package/project/root/index.esm.js +98 -406
- package/project/traversal/index.cjs.js +96 -622
- package/project/traversal/index.d.ts +165 -3
- package/project/traversal/index.d.ts.map +1 -1
- package/project/traversal/index.esm.js +82 -608
- package/tech/backend/index.cjs.js +223 -508
- package/tech/backend/index.d.ts +205 -8
- package/tech/backend/index.d.ts.map +1 -1
- package/tech/backend/index.esm.js +202 -487
- package/tech/build/index.cjs.js +350 -636
- package/tech/build/index.d.ts +276 -10
- package/tech/build/index.d.ts.map +1 -1
- package/tech/build/index.esm.js +328 -614
- package/tech/frontend/index.cjs.js +507 -685
- package/tech/frontend/index.d.ts +379 -15
- package/tech/frontend/index.d.ts.map +1 -1
- package/tech/frontend/index.esm.js +483 -661
- package/tech/index.cjs.js +1581 -1420
- package/tech/index.d.ts +55 -32
- package/tech/index.d.ts.map +1 -1
- package/tech/index.esm.js +1515 -1354
- package/tech/legacy/index.cjs.js +99 -449
- package/tech/legacy/index.d.ts +125 -7
- package/tech/legacy/index.d.ts.map +1 -1
- package/tech/legacy/index.esm.js +81 -431
- package/tech/linting/index.cjs.js +138 -523
- package/tech/linting/index.d.ts +129 -7
- package/tech/linting/index.d.ts.map +1 -1
- package/tech/linting/index.esm.js +118 -503
- package/tech/monorepo/index.cjs.js +246 -573
- package/tech/monorepo/index.d.ts +241 -10
- package/tech/monorepo/index.d.ts.map +1 -1
- package/tech/monorepo/index.esm.js +226 -553
- package/tech/testing/index.cjs.js +216 -571
- package/tech/testing/index.d.ts +176 -8
- package/tech/testing/index.d.ts.map +1 -1
- package/tech/testing/index.esm.js +198 -553
- package/tech/types/index.cjs.js +123 -506
- package/tech/types/index.d.ts +120 -2
- package/tech/types/index.d.ts.map +1 -1
- package/tech/types/index.esm.js +101 -484
- package/vfs/index.cjs.js +647 -1142
- package/vfs/index.d.ts +360 -6
- package/vfs/index.d.ts.map +1 -1
- package/vfs/index.esm.js +672 -1167
- package/ARCHITECTURE.md +0 -370
- package/analyze.d.ts +0 -33
- package/analyze.d.ts.map +0 -1
- package/cli/commands/analyze.d.ts +0 -28
- package/cli/commands/analyze.d.ts.map +0 -1
- package/cli/commands/config.d.ts +0 -27
- package/cli/commands/config.d.ts.map +0 -1
- package/cli/commands/deps.d.ts +0 -24
- package/cli/commands/deps.d.ts.map +0 -1
- package/cli/commands/tree.d.ts +0 -36
- package/cli/commands/tree.d.ts.map +0 -1
- package/cli/index.cjs.js.map +0 -1
- package/cli/index.esm.js.map +0 -1
- package/cli/run.d.ts +0 -25
- package/cli/run.d.ts.map +0 -1
- package/cli/types.d.ts +0 -55
- package/cli/types.d.ts.map +0 -1
- package/core/cache.d.ts +0 -158
- package/core/cache.d.ts.map +0 -1
- package/core/encoding/convert.d.ts +0 -32
- package/core/encoding/convert.d.ts.map +0 -1
- package/core/encoding/detect.d.ts +0 -91
- package/core/encoding/detect.d.ts.map +0 -1
- package/core/encoding/index.cjs.js.map +0 -1
- package/core/encoding/index.esm.js.map +0 -1
- package/core/errors/structured-errors.d.ts +0 -66
- package/core/errors/structured-errors.d.ts.map +0 -1
- package/core/fs/directory.d.ts +0 -91
- package/core/fs/directory.d.ts.map +0 -1
- package/core/fs/index.cjs.js.map +0 -1
- package/core/fs/index.esm.js.map +0 -1
- package/core/fs/read.d.ts +0 -94
- package/core/fs/read.d.ts.map +0 -1
- package/core/fs/stat.d.ts +0 -58
- package/core/fs/stat.d.ts.map +0 -1
- package/core/fs/traversal.d.ts +0 -26
- package/core/fs/traversal.d.ts.map +0 -1
- package/core/fs/write.d.ts +0 -75
- package/core/fs/write.d.ts.map +0 -1
- package/core/index.cjs.js.map +0 -1
- package/core/index.esm.js.map +0 -1
- package/core/logger.d.ts +0 -111
- package/core/logger.d.ts.map +0 -1
- package/core/path/index.cjs.js.map +0 -1
- package/core/path/index.esm.js.map +0 -1
- package/core/path/join.d.ts +0 -17
- package/core/path/join.d.ts.map +0 -1
- package/core/path/normalize.d.ts +0 -37
- package/core/path/normalize.d.ts.map +0 -1
- package/core/path/resolve.d.ts +0 -52
- package/core/path/resolve.d.ts.map +0 -1
- package/core/path/segments.d.ts +0 -59
- package/core/path/segments.d.ts.map +0 -1
- package/core/patterns/glob.d.ts +0 -42
- package/core/patterns/glob.d.ts.map +0 -1
- package/core/platform/detect.d.ts +0 -66
- package/core/platform/detect.d.ts.map +0 -1
- package/core/platform/index.cjs.js.map +0 -1
- package/core/platform/index.esm.js.map +0 -1
- package/core/platform/line-endings.d.ts +0 -48
- package/core/platform/line-endings.d.ts.map +0 -1
- package/heuristics/dependencies/analyze.d.ts +0 -77
- package/heuristics/dependencies/analyze.d.ts.map +0 -1
- package/heuristics/dependencies/index.cjs.js.map +0 -1
- package/heuristics/dependencies/index.esm.js.map +0 -1
- package/heuristics/entry-points/discover.d.ts +0 -113
- package/heuristics/entry-points/discover.d.ts.map +0 -1
- package/heuristics/entry-points/index.cjs.js.map +0 -1
- package/heuristics/entry-points/index.esm.js.map +0 -1
- package/heuristics/framework/identify.d.ts +0 -84
- package/heuristics/framework/identify.d.ts.map +0 -1
- package/heuristics/framework/index.cjs.js.map +0 -1
- package/heuristics/framework/index.esm.js.map +0 -1
- package/heuristics/index.cjs.js.map +0 -1
- package/heuristics/index.esm.js.map +0 -1
- package/heuristics/project-type/detect.d.ts +0 -61
- package/heuristics/project-type/detect.d.ts.map +0 -1
- package/heuristics/project-type/index.cjs.js.map +0 -1
- package/heuristics/project-type/index.esm.js.map +0 -1
- package/index.cjs.js.map +0 -1
- package/index.esm.js.map +0 -1
- package/models/index.cjs.js.map +0 -1
- package/models/index.esm.js.map +0 -1
- package/nx/detect.d.ts +0 -105
- package/nx/detect.d.ts.map +0 -1
- package/nx/devkit-loader.d.ts +0 -62
- package/nx/devkit-loader.d.ts.map +0 -1
- package/nx/index.cjs.js.map +0 -1
- package/nx/index.esm.js.map +0 -1
- package/nx/project-config.d.ts +0 -111
- package/nx/project-config.d.ts.map +0 -1
- package/project/config/detect.d.ts +0 -77
- package/project/config/detect.d.ts.map +0 -1
- package/project/config/index.cjs.js.map +0 -1
- package/project/config/index.esm.js.map +0 -1
- package/project/config/parse.d.ts +0 -53
- package/project/config/parse.d.ts.map +0 -1
- package/project/config/patterns.d.ts +0 -31
- package/project/config/patterns.d.ts.map +0 -1
- package/project/index.cjs.js.map +0 -1
- package/project/index.esm.js.map +0 -1
- package/project/package/dependencies.d.ts +0 -101
- package/project/package/dependencies.d.ts.map +0 -1
- package/project/package/index.cjs.js.map +0 -1
- package/project/package/index.esm.js.map +0 -1
- package/project/package/read.d.ts +0 -67
- package/project/package/read.d.ts.map +0 -1
- package/project/root/detect.d.ts +0 -65
- package/project/root/detect.d.ts.map +0 -1
- package/project/root/index.cjs.js.map +0 -1
- package/project/root/index.esm.js.map +0 -1
- package/project/traversal/index.cjs.js.map +0 -1
- package/project/traversal/index.esm.js.map +0 -1
- package/project/traversal/search.d.ts +0 -59
- package/project/traversal/search.d.ts.map +0 -1
- package/project/traversal/walk.d.ts +0 -63
- package/project/traversal/walk.d.ts.map +0 -1
- package/tech/backend/detect-all.d.ts +0 -13
- package/tech/backend/detect-all.d.ts.map +0 -1
- package/tech/backend/express.d.ts +0 -11
- package/tech/backend/express.d.ts.map +0 -1
- package/tech/backend/fastify.d.ts +0 -11
- package/tech/backend/fastify.d.ts.map +0 -1
- package/tech/backend/hono.d.ts +0 -11
- package/tech/backend/hono.d.ts.map +0 -1
- package/tech/backend/index.cjs.js.map +0 -1
- package/tech/backend/index.esm.js.map +0 -1
- package/tech/backend/koa.d.ts +0 -11
- package/tech/backend/koa.d.ts.map +0 -1
- package/tech/backend/nestjs.d.ts +0 -11
- package/tech/backend/nestjs.d.ts.map +0 -1
- package/tech/backend/types.d.ts +0 -31
- package/tech/backend/types.d.ts.map +0 -1
- package/tech/build/babel.d.ts +0 -13
- package/tech/build/babel.d.ts.map +0 -1
- package/tech/build/detect-all.d.ts +0 -13
- package/tech/build/detect-all.d.ts.map +0 -1
- package/tech/build/esbuild.d.ts +0 -11
- package/tech/build/esbuild.d.ts.map +0 -1
- package/tech/build/index.cjs.js.map +0 -1
- package/tech/build/index.esm.js.map +0 -1
- package/tech/build/parcel.d.ts +0 -13
- package/tech/build/parcel.d.ts.map +0 -1
- package/tech/build/rollup.d.ts +0 -13
- package/tech/build/rollup.d.ts.map +0 -1
- package/tech/build/swc.d.ts +0 -13
- package/tech/build/swc.d.ts.map +0 -1
- package/tech/build/types.d.ts +0 -31
- package/tech/build/types.d.ts.map +0 -1
- package/tech/build/vite.d.ts +0 -13
- package/tech/build/vite.d.ts.map +0 -1
- package/tech/build/webpack.d.ts +0 -13
- package/tech/build/webpack.d.ts.map +0 -1
- package/tech/frontend/angular.d.ts +0 -11
- package/tech/frontend/angular.d.ts.map +0 -1
- package/tech/frontend/astro.d.ts +0 -11
- package/tech/frontend/astro.d.ts.map +0 -1
- package/tech/frontend/detect-all.d.ts +0 -13
- package/tech/frontend/detect-all.d.ts.map +0 -1
- package/tech/frontend/gatsby.d.ts +0 -11
- package/tech/frontend/gatsby.d.ts.map +0 -1
- package/tech/frontend/index.cjs.js.map +0 -1
- package/tech/frontend/index.esm.js.map +0 -1
- package/tech/frontend/nextjs.d.ts +0 -11
- package/tech/frontend/nextjs.d.ts.map +0 -1
- package/tech/frontend/nuxt.d.ts +0 -11
- package/tech/frontend/nuxt.d.ts.map +0 -1
- package/tech/frontend/qwik.d.ts +0 -11
- package/tech/frontend/qwik.d.ts.map +0 -1
- package/tech/frontend/react.d.ts +0 -11
- package/tech/frontend/react.d.ts.map +0 -1
- package/tech/frontend/remix.d.ts +0 -11
- package/tech/frontend/remix.d.ts.map +0 -1
- package/tech/frontend/solid.d.ts +0 -11
- package/tech/frontend/solid.d.ts.map +0 -1
- package/tech/frontend/svelte.d.ts +0 -11
- package/tech/frontend/svelte.d.ts.map +0 -1
- package/tech/frontend/sveltekit.d.ts +0 -11
- package/tech/frontend/sveltekit.d.ts.map +0 -1
- package/tech/frontend/types.d.ts +0 -35
- package/tech/frontend/types.d.ts.map +0 -1
- package/tech/frontend/vue.d.ts +0 -11
- package/tech/frontend/vue.d.ts.map +0 -1
- package/tech/index.cjs.js.map +0 -1
- package/tech/index.esm.js.map +0 -1
- package/tech/legacy/angularjs.d.ts +0 -12
- package/tech/legacy/angularjs.d.ts.map +0 -1
- package/tech/legacy/backbone.d.ts +0 -11
- package/tech/legacy/backbone.d.ts.map +0 -1
- package/tech/legacy/detect-all.d.ts +0 -13
- package/tech/legacy/detect-all.d.ts.map +0 -1
- package/tech/legacy/ember.d.ts +0 -11
- package/tech/legacy/ember.d.ts.map +0 -1
- package/tech/legacy/index.cjs.js.map +0 -1
- package/tech/legacy/index.esm.js.map +0 -1
- package/tech/legacy/jquery.d.ts +0 -11
- package/tech/legacy/jquery.d.ts.map +0 -1
- package/tech/legacy/types.d.ts +0 -33
- package/tech/legacy/types.d.ts.map +0 -1
- package/tech/linting/biome.d.ts +0 -11
- package/tech/linting/biome.d.ts.map +0 -1
- package/tech/linting/detect-all.d.ts +0 -13
- package/tech/linting/detect-all.d.ts.map +0 -1
- package/tech/linting/eslint.d.ts +0 -13
- package/tech/linting/eslint.d.ts.map +0 -1
- package/tech/linting/index.cjs.js.map +0 -1
- package/tech/linting/index.esm.js.map +0 -1
- package/tech/linting/prettier.d.ts +0 -13
- package/tech/linting/prettier.d.ts.map +0 -1
- package/tech/linting/stylelint.d.ts +0 -13
- package/tech/linting/stylelint.d.ts.map +0 -1
- package/tech/linting/types.d.ts +0 -31
- package/tech/linting/types.d.ts.map +0 -1
- package/tech/monorepo/detect-all.d.ts +0 -13
- package/tech/monorepo/detect-all.d.ts.map +0 -1
- package/tech/monorepo/index.cjs.js.map +0 -1
- package/tech/monorepo/index.esm.js.map +0 -1
- package/tech/monorepo/lerna.d.ts +0 -11
- package/tech/monorepo/lerna.d.ts.map +0 -1
- package/tech/monorepo/npm-workspaces.d.ts +0 -11
- package/tech/monorepo/npm-workspaces.d.ts.map +0 -1
- package/tech/monorepo/nx.d.ts +0 -11
- package/tech/monorepo/nx.d.ts.map +0 -1
- package/tech/monorepo/pnpm-workspaces.d.ts +0 -9
- package/tech/monorepo/pnpm-workspaces.d.ts.map +0 -1
- package/tech/monorepo/rush.d.ts +0 -11
- package/tech/monorepo/rush.d.ts.map +0 -1
- package/tech/monorepo/turborepo.d.ts +0 -11
- package/tech/monorepo/turborepo.d.ts.map +0 -1
- package/tech/monorepo/types.d.ts +0 -39
- package/tech/monorepo/types.d.ts.map +0 -1
- package/tech/monorepo/yarn-workspaces.d.ts +0 -11
- package/tech/monorepo/yarn-workspaces.d.ts.map +0 -1
- package/tech/shared-utils/detector-helpers.d.ts +0 -52
- package/tech/shared-utils/detector-helpers.d.ts.map +0 -1
- package/tech/shared-utils/types.d.ts +0 -41
- package/tech/shared-utils/types.d.ts.map +0 -1
- package/tech/testing/cypress.d.ts +0 -13
- package/tech/testing/cypress.d.ts.map +0 -1
- package/tech/testing/detect-all.d.ts +0 -13
- package/tech/testing/detect-all.d.ts.map +0 -1
- package/tech/testing/index.cjs.js.map +0 -1
- package/tech/testing/index.esm.js.map +0 -1
- package/tech/testing/jest.d.ts +0 -13
- package/tech/testing/jest.d.ts.map +0 -1
- package/tech/testing/mocha.d.ts +0 -13
- package/tech/testing/mocha.d.ts.map +0 -1
- package/tech/testing/playwright.d.ts +0 -13
- package/tech/testing/playwright.d.ts.map +0 -1
- package/tech/testing/types.d.ts +0 -35
- package/tech/testing/types.d.ts.map +0 -1
- package/tech/testing/vitest.d.ts +0 -13
- package/tech/testing/vitest.d.ts.map +0 -1
- package/tech/types/detectors.d.ts +0 -67
- package/tech/types/detectors.d.ts.map +0 -1
- package/tech/types/index.cjs.js.map +0 -1
- package/tech/types/index.esm.js.map +0 -1
- package/vfs/commit.d.ts +0 -32
- package/vfs/commit.d.ts.map +0 -1
- package/vfs/diff.d.ts +0 -73
- package/vfs/diff.d.ts.map +0 -1
- package/vfs/factory.d.ts +0 -37
- package/vfs/factory.d.ts.map +0 -1
- package/vfs/fs-tree.d.ts +0 -13
- package/vfs/fs-tree.d.ts.map +0 -1
- package/vfs/index.cjs.js.map +0 -1
- package/vfs/index.esm.js.map +0 -1
- package/vfs/types.d.ts +0 -179
- package/vfs/types.d.ts.map +0 -1
|
@@ -1,714 +1,28 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
'pnpm-lock.yaml': {
|
|
21
|
-
patterns: ['pnpm-lock.yaml'],
|
|
22
|
-
format: 'yaml',
|
|
23
|
-
description: 'PNPM lockfile',
|
|
24
|
-
},
|
|
25
|
-
'yarn.lock': {
|
|
26
|
-
patterns: ['yarn.lock'],
|
|
27
|
-
format: 'text',
|
|
28
|
-
description: 'Yarn lockfile',
|
|
29
|
-
},
|
|
30
|
-
'.npmrc': {
|
|
31
|
-
patterns: ['.npmrc'],
|
|
32
|
-
format: 'ini',
|
|
33
|
-
description: 'NPM configuration',
|
|
34
|
-
sensitive: true,
|
|
35
|
-
},
|
|
36
|
-
tsconfig: {
|
|
37
|
-
patterns: ['tsconfig.json', 'tsconfig.*.json'],
|
|
38
|
-
format: 'jsonc',
|
|
39
|
-
description: 'TypeScript configuration',
|
|
40
|
-
canExtend: true,
|
|
41
|
-
},
|
|
42
|
-
nx: {
|
|
43
|
-
patterns: ['nx.json'],
|
|
44
|
-
format: 'json',
|
|
45
|
-
description: 'NX workspace configuration',
|
|
46
|
-
},
|
|
47
|
-
'project.json': {
|
|
48
|
-
patterns: ['project.json', '**/project.json'],
|
|
49
|
-
format: 'json',
|
|
50
|
-
description: 'NX project configuration',
|
|
51
|
-
},
|
|
52
|
-
'workspace.json': {
|
|
53
|
-
patterns: ['workspace.json'],
|
|
54
|
-
format: 'json',
|
|
55
|
-
description: 'NX workspace projects (deprecated)',
|
|
56
|
-
},
|
|
57
|
-
turbo: {
|
|
58
|
-
patterns: ['turbo.json'],
|
|
59
|
-
format: 'jsonc',
|
|
60
|
-
description: 'TurboRepo configuration',
|
|
61
|
-
},
|
|
62
|
-
lerna: {
|
|
63
|
-
patterns: ['lerna.json'],
|
|
64
|
-
format: 'json',
|
|
65
|
-
description: 'Lerna configuration',
|
|
66
|
-
},
|
|
67
|
-
webpack: {
|
|
68
|
-
patterns: ['webpack.config.js', 'webpack.config.ts', 'webpack.config.cjs', 'webpack.config.mjs'],
|
|
69
|
-
format: 'js',
|
|
70
|
-
description: 'Webpack configuration',
|
|
71
|
-
},
|
|
72
|
-
rollup: {
|
|
73
|
-
patterns: ['rollup.config.js', 'rollup.config.ts', 'rollup.config.mjs'],
|
|
74
|
-
format: 'js',
|
|
75
|
-
description: 'Rollup configuration',
|
|
76
|
-
},
|
|
77
|
-
vite: {
|
|
78
|
-
patterns: ['vite.config.js', 'vite.config.ts', 'vite.config.mjs'],
|
|
79
|
-
format: 'js',
|
|
80
|
-
description: 'Vite configuration',
|
|
81
|
-
},
|
|
82
|
-
esbuild: {
|
|
83
|
-
patterns: ['esbuild.config.js', 'esbuild.config.ts', 'esbuild.config.mjs'],
|
|
84
|
-
format: 'js',
|
|
85
|
-
description: 'esbuild configuration',
|
|
86
|
-
},
|
|
87
|
-
babel: {
|
|
88
|
-
patterns: ['babel.config.js', 'babel.config.json', '.babelrc', '.babelrc.js', '.babelrc.json'],
|
|
89
|
-
format: 'json',
|
|
90
|
-
description: 'Babel configuration',
|
|
91
|
-
},
|
|
92
|
-
swc: {
|
|
93
|
-
patterns: ['.swcrc'],
|
|
94
|
-
format: 'json',
|
|
95
|
-
description: 'SWC configuration',
|
|
96
|
-
},
|
|
97
|
-
jest: {
|
|
98
|
-
patterns: ['jest.config.js', 'jest.config.ts', 'jest.config.mjs'],
|
|
99
|
-
description: 'Jest configuration',
|
|
100
|
-
},
|
|
101
|
-
vitest: {
|
|
102
|
-
patterns: ['vitest.config.js', 'vitest.config.ts'],
|
|
103
|
-
description: 'Vitest configuration',
|
|
104
|
-
},
|
|
105
|
-
cypress: {
|
|
106
|
-
patterns: ['cypress.config.js', 'cypress.config.ts'],
|
|
107
|
-
description: 'Cypress configuration',
|
|
108
|
-
},
|
|
109
|
-
playwright: {
|
|
110
|
-
patterns: ['playwright.config.js', 'playwright.config.ts'],
|
|
111
|
-
description: 'Playwright configuration',
|
|
112
|
-
},
|
|
113
|
-
next: {
|
|
114
|
-
patterns: ['next.config.js', 'next.config.mjs', 'next.config.ts'],
|
|
115
|
-
format: 'js',
|
|
116
|
-
description: 'Next.js configuration',
|
|
117
|
-
},
|
|
118
|
-
angular: {
|
|
119
|
-
patterns: ['angular.json'],
|
|
120
|
-
format: 'json',
|
|
121
|
-
description: 'Angular CLI configuration',
|
|
122
|
-
},
|
|
123
|
-
nuxt: {
|
|
124
|
-
patterns: ['nuxt.config.js', 'nuxt.config.ts'],
|
|
125
|
-
format: 'js',
|
|
126
|
-
description: 'Nuxt.js configuration',
|
|
127
|
-
},
|
|
128
|
-
svelte: {
|
|
129
|
-
patterns: ['svelte.config.js', 'svelte.config.ts'],
|
|
130
|
-
format: 'js',
|
|
131
|
-
description: 'SvelteKit configuration',
|
|
132
|
-
},
|
|
133
|
-
astro: {
|
|
134
|
-
patterns: ['astro.config.js', 'astro.config.ts', 'astro.config.mjs'],
|
|
135
|
-
format: 'js',
|
|
136
|
-
description: 'Astro configuration',
|
|
137
|
-
},
|
|
138
|
-
eslint: {
|
|
139
|
-
patterns: [
|
|
140
|
-
'eslint.config.js',
|
|
141
|
-
'eslint.config.cjs',
|
|
142
|
-
'eslint.config.mjs',
|
|
143
|
-
'.eslintrc',
|
|
144
|
-
'.eslintrc.js',
|
|
145
|
-
'.eslintrc.json',
|
|
146
|
-
'.eslintrc.yml',
|
|
147
|
-
],
|
|
148
|
-
format: 'js',
|
|
149
|
-
description: 'ESLint configuration',
|
|
150
|
-
},
|
|
151
|
-
prettier: {
|
|
152
|
-
patterns: ['prettier.config.js', 'prettier.config.cjs', '.prettierrc', '.prettierrc.js', '.prettierrc.json', '.prettierrc.yml'],
|
|
153
|
-
format: 'json',
|
|
154
|
-
description: 'Prettier configuration',
|
|
155
|
-
},
|
|
156
|
-
env: {
|
|
157
|
-
patterns: ['.env', '.env.*', '*.env'],
|
|
158
|
-
format: 'dotenv',
|
|
159
|
-
description: 'Environment variables',
|
|
160
|
-
sensitive: true,
|
|
161
|
-
},
|
|
162
|
-
'.gitignore': {
|
|
163
|
-
patterns: ['.gitignore'],
|
|
164
|
-
format: 'text',
|
|
165
|
-
description: 'Git ignore patterns',
|
|
166
|
-
},
|
|
167
|
-
'.gitattributes': {
|
|
168
|
-
patterns: ['.gitattributes'],
|
|
169
|
-
format: 'text',
|
|
170
|
-
description: 'Git attributes',
|
|
171
|
-
},
|
|
172
|
-
};
|
|
173
|
-
/**
|
|
174
|
-
* Get patterns for specific config types.
|
|
175
|
-
*
|
|
176
|
-
* @param types - Array of config types to get patterns for
|
|
177
|
-
* @returns Array of file patterns
|
|
178
|
-
*/
|
|
179
|
-
function getConfigPatternsByType(types) {
|
|
180
|
-
return types.flatMap((type) => CONFIG_PATTERNS[type]?.patterns ?? []);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Safe copies of Object built-in methods.
|
|
185
|
-
*
|
|
186
|
-
* These references are captured at module initialization time to protect against
|
|
187
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
188
|
-
*
|
|
189
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/object
|
|
190
|
-
*/
|
|
191
|
-
const _Object = globalThis.Object;
|
|
192
|
-
/**
|
|
193
|
-
* (Safe copy) Prevents modification of existing property attributes and values,
|
|
194
|
-
* and prevents the addition of new properties.
|
|
195
|
-
*/
|
|
196
|
-
const freeze = _Object.freeze;
|
|
197
|
-
/**
|
|
198
|
-
* (Safe copy) Returns the names of the enumerable string properties and methods of an object.
|
|
199
|
-
*/
|
|
200
|
-
const keys = _Object.keys;
|
|
201
|
-
/**
|
|
202
|
-
* (Safe copy) Returns an array of key/values of the enumerable own properties of an object.
|
|
203
|
-
*/
|
|
204
|
-
const entries = _Object.entries;
|
|
205
|
-
/**
|
|
206
|
-
* (Safe copy) Adds one or more properties to an object, and/or modifies attributes of existing properties.
|
|
207
|
-
*/
|
|
208
|
-
const defineProperties = _Object.defineProperties;
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Safe copies of Map built-in via factory function.
|
|
212
|
-
*
|
|
213
|
-
* Since constructors cannot be safely captured via Object.assign, this module
|
|
214
|
-
* provides a factory function that uses Reflect.construct internally.
|
|
215
|
-
*
|
|
216
|
-
* These references are captured at module initialization time to protect against
|
|
217
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
218
|
-
*
|
|
219
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/map
|
|
220
|
-
*/
|
|
221
|
-
const _Map = globalThis.Map;
|
|
222
|
-
const _Reflect$2 = globalThis.Reflect;
|
|
223
|
-
/**
|
|
224
|
-
* (Safe copy) Creates a new Map using the captured Map constructor.
|
|
225
|
-
* Use this instead of `new Map()`.
|
|
226
|
-
*
|
|
227
|
-
* @param iterable - Optional iterable of key-value pairs.
|
|
228
|
-
* @returns A new Map instance.
|
|
229
|
-
*/
|
|
230
|
-
const createMap = (iterable) => _Reflect$2.construct(_Map, iterable ? [iterable] : []);
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Safe copies of Set built-in via factory function.
|
|
234
|
-
*
|
|
235
|
-
* Since constructors cannot be safely captured via Object.assign, this module
|
|
236
|
-
* provides a factory function that uses Reflect.construct internally.
|
|
237
|
-
*
|
|
238
|
-
* These references are captured at module initialization time to protect against
|
|
239
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
240
|
-
*
|
|
241
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/set
|
|
242
|
-
*/
|
|
243
|
-
const _Set = globalThis.Set;
|
|
244
|
-
const _Reflect$1 = globalThis.Reflect;
|
|
245
|
-
/**
|
|
246
|
-
* (Safe copy) Creates a new Set using the captured Set constructor.
|
|
247
|
-
* Use this instead of `new Set()`.
|
|
248
|
-
*
|
|
249
|
-
* @param iterable - Optional iterable of values.
|
|
250
|
-
* @returns A new Set instance.
|
|
251
|
-
*/
|
|
252
|
-
const createSet = (iterable) => _Reflect$1.construct(_Set, iterable ? [iterable] : []);
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Global registry of all caches for bulk operations.
|
|
256
|
-
*/
|
|
257
|
-
const cacheRegistry = createSet();
|
|
258
|
-
/**
|
|
259
|
-
* Create a cache with optional TTL and size limits.
|
|
260
|
-
*
|
|
261
|
-
* The cache provides a simple key-value store with:
|
|
262
|
-
* - Optional TTL (time-to-live) for automatic expiration
|
|
263
|
-
* - Optional maxSize for limiting cache size with FIFO eviction
|
|
264
|
-
* - Lazy expiration (entries are checked on access)
|
|
265
|
-
*
|
|
266
|
-
* @param options - Cache configuration options
|
|
267
|
-
* @returns Cache instance
|
|
268
|
-
*
|
|
269
|
-
* @example
|
|
270
|
-
* ```typescript
|
|
271
|
-
* // Basic cache
|
|
272
|
-
* const cache = createCache<string, number>()
|
|
273
|
-
* cache.set('answer', 42)
|
|
274
|
-
* cache.get('answer') // 42
|
|
275
|
-
*
|
|
276
|
-
* // Cache with TTL (expires after 60 seconds)
|
|
277
|
-
* const ttlCache = createCache<string, object>({ ttl: 60000 })
|
|
278
|
-
*
|
|
279
|
-
* // Cache with max size (evicts oldest when full)
|
|
280
|
-
* const lruCache = createCache<string, object>({ maxSize: 100 })
|
|
281
|
-
*
|
|
282
|
-
* // Combined options
|
|
283
|
-
* const configCache = createCache<string, object>({
|
|
284
|
-
* ttl: 30000,
|
|
285
|
-
* maxSize: 50
|
|
286
|
-
* })
|
|
287
|
-
* ```
|
|
288
|
-
*/
|
|
289
|
-
function createCache(options) {
|
|
290
|
-
const { ttl, maxSize } = options ?? {};
|
|
291
|
-
const store = createMap();
|
|
292
|
-
const insertionOrder = [];
|
|
293
|
-
/**
|
|
294
|
-
* Check if an entry is expired.
|
|
295
|
-
*
|
|
296
|
-
* @param entry - Cache entry to check
|
|
297
|
-
* @returns True if entry is expired
|
|
298
|
-
*/
|
|
299
|
-
function isExpired(entry) {
|
|
300
|
-
if (ttl === undefined)
|
|
301
|
-
return false;
|
|
302
|
-
// eslint-disable-next-line workspace/no-unsafe-builtin-methods -- Date.now() is needed for Jest fake timers compatibility
|
|
303
|
-
return Date.now() - entry.timestamp > ttl;
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Evict oldest entries to make room for new ones.
|
|
307
|
-
*/
|
|
308
|
-
function evictIfNeeded() {
|
|
309
|
-
if (maxSize === undefined)
|
|
310
|
-
return;
|
|
311
|
-
while (store.size >= maxSize && insertionOrder.length > 0) {
|
|
312
|
-
const oldestKey = insertionOrder.shift();
|
|
313
|
-
if (oldestKey !== undefined) {
|
|
314
|
-
store.delete(oldestKey);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Remove key from insertion order tracking.
|
|
320
|
-
*
|
|
321
|
-
* @param key - Key to remove from order tracking
|
|
322
|
-
*/
|
|
323
|
-
function removeFromOrder(key) {
|
|
324
|
-
const index = insertionOrder.indexOf(key);
|
|
325
|
-
if (index !== -1) {
|
|
326
|
-
insertionOrder.splice(index, 1);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
const cache = {
|
|
330
|
-
get(key) {
|
|
331
|
-
const entry = store.get(key);
|
|
332
|
-
if (!entry)
|
|
333
|
-
return undefined;
|
|
334
|
-
if (isExpired(entry)) {
|
|
335
|
-
store.delete(key);
|
|
336
|
-
removeFromOrder(key);
|
|
337
|
-
return undefined;
|
|
338
|
-
}
|
|
339
|
-
return entry.value;
|
|
340
|
-
},
|
|
341
|
-
set(key, value) {
|
|
342
|
-
if (store.has(key)) {
|
|
343
|
-
removeFromOrder(key);
|
|
344
|
-
}
|
|
345
|
-
else {
|
|
346
|
-
evictIfNeeded();
|
|
347
|
-
}
|
|
348
|
-
// eslint-disable-next-line workspace/no-unsafe-builtin-methods -- Date.now() is needed for Jest fake timers compatibility
|
|
349
|
-
store.set(key, { value, timestamp: Date.now() });
|
|
350
|
-
insertionOrder.push(key);
|
|
351
|
-
},
|
|
352
|
-
has(key) {
|
|
353
|
-
const entry = store.get(key);
|
|
354
|
-
if (!entry)
|
|
355
|
-
return false;
|
|
356
|
-
if (isExpired(entry)) {
|
|
357
|
-
store.delete(key);
|
|
358
|
-
removeFromOrder(key);
|
|
359
|
-
return false;
|
|
360
|
-
}
|
|
361
|
-
return true;
|
|
362
|
-
},
|
|
363
|
-
delete(key) {
|
|
364
|
-
removeFromOrder(key);
|
|
365
|
-
return store.delete(key);
|
|
366
|
-
},
|
|
367
|
-
clear() {
|
|
368
|
-
store.clear();
|
|
369
|
-
insertionOrder.length = 0;
|
|
370
|
-
},
|
|
371
|
-
size() {
|
|
372
|
-
return store.size;
|
|
373
|
-
},
|
|
374
|
-
keys() {
|
|
375
|
-
return [...insertionOrder];
|
|
376
|
-
},
|
|
377
|
-
};
|
|
378
|
-
cacheRegistry.add(cache);
|
|
379
|
-
return freeze(cache);
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* Safe copies of Error built-ins via factory functions.
|
|
384
|
-
*
|
|
385
|
-
* Since constructors cannot be safely captured via Object.assign, this module
|
|
386
|
-
* provides factory functions that use Reflect.construct internally.
|
|
387
|
-
*
|
|
388
|
-
* These references are captured at module initialization time to protect against
|
|
389
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
390
|
-
*
|
|
391
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/error
|
|
392
|
-
*/
|
|
393
|
-
const _Error = globalThis.Error;
|
|
394
|
-
const _Reflect = globalThis.Reflect;
|
|
395
|
-
/**
|
|
396
|
-
* (Safe copy) Creates a new Error using the captured Error constructor.
|
|
397
|
-
* Use this instead of `new Error()`.
|
|
398
|
-
*
|
|
399
|
-
* @param message - Optional error message.
|
|
400
|
-
* @param options - Optional error options.
|
|
401
|
-
* @returns A new Error instance.
|
|
402
|
-
*/
|
|
403
|
-
const createError = (message, options) => _Reflect.construct(_Error, [message, options]);
|
|
404
|
-
|
|
405
|
-
/**
|
|
406
|
-
* Safe copies of JSON built-in methods.
|
|
407
|
-
*
|
|
408
|
-
* These references are captured at module initialization time to protect against
|
|
409
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
410
|
-
*
|
|
411
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/json
|
|
412
|
-
*/
|
|
413
|
-
const _JSON = globalThis.JSON;
|
|
414
|
-
/**
|
|
415
|
-
* (Safe copy) Converts a JavaScript Object Notation (JSON) string into an object.
|
|
416
|
-
*/
|
|
417
|
-
const parse = _JSON.parse;
|
|
418
|
-
/**
|
|
419
|
-
* (Safe copy) Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
|
|
420
|
-
*/
|
|
421
|
-
const stringify = _JSON.stringify;
|
|
422
|
-
|
|
423
|
-
/**
|
|
424
|
-
* Safe copies of Array built-in static methods.
|
|
425
|
-
*
|
|
426
|
-
* These references are captured at module initialization time to protect against
|
|
427
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
428
|
-
*
|
|
429
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/array
|
|
430
|
-
*/
|
|
431
|
-
const _Array = globalThis.Array;
|
|
432
|
-
/**
|
|
433
|
-
* (Safe copy) Determines whether the passed value is an Array.
|
|
434
|
-
*/
|
|
435
|
-
const isArray = _Array.isArray;
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
* Safe copies of Console built-in methods.
|
|
439
|
-
*
|
|
440
|
-
* These references are captured at module initialization time to protect against
|
|
441
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
442
|
-
*
|
|
443
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/console
|
|
444
|
-
*/
|
|
445
|
-
const _console = globalThis.console;
|
|
446
|
-
/**
|
|
447
|
-
* (Safe copy) Outputs a message to the console.
|
|
448
|
-
*/
|
|
449
|
-
const log = _console.log.bind(_console);
|
|
450
|
-
/**
|
|
451
|
-
* (Safe copy) Outputs a warning message to the console.
|
|
452
|
-
*/
|
|
453
|
-
const warn = _console.warn.bind(_console);
|
|
454
|
-
/**
|
|
455
|
-
* (Safe copy) Outputs an error message to the console.
|
|
456
|
-
*/
|
|
457
|
-
const error = _console.error.bind(_console);
|
|
458
|
-
/**
|
|
459
|
-
* (Safe copy) Outputs an informational message to the console.
|
|
460
|
-
*/
|
|
461
|
-
const info = _console.info.bind(_console);
|
|
462
|
-
/**
|
|
463
|
-
* (Safe copy) Outputs a debug message to the console.
|
|
464
|
-
*/
|
|
465
|
-
const debug = _console.debug.bind(_console);
|
|
466
|
-
/**
|
|
467
|
-
* (Safe copy) Outputs a stack trace to the console.
|
|
468
|
-
*/
|
|
469
|
-
_console.trace.bind(_console);
|
|
470
|
-
/**
|
|
471
|
-
* (Safe copy) Displays an interactive listing of the properties of a specified object.
|
|
472
|
-
*/
|
|
473
|
-
_console.dir.bind(_console);
|
|
474
|
-
/**
|
|
475
|
-
* (Safe copy) Displays tabular data as a table.
|
|
476
|
-
*/
|
|
477
|
-
_console.table.bind(_console);
|
|
478
|
-
/**
|
|
479
|
-
* (Safe copy) Writes an error message to the console if the assertion is false.
|
|
480
|
-
*/
|
|
481
|
-
_console.assert.bind(_console);
|
|
482
|
-
/**
|
|
483
|
-
* (Safe copy) Clears the console.
|
|
484
|
-
*/
|
|
485
|
-
_console.clear.bind(_console);
|
|
486
|
-
/**
|
|
487
|
-
* (Safe copy) Logs the number of times that this particular call to count() has been called.
|
|
488
|
-
*/
|
|
489
|
-
_console.count.bind(_console);
|
|
490
|
-
/**
|
|
491
|
-
* (Safe copy) Resets the counter used with console.count().
|
|
492
|
-
*/
|
|
493
|
-
_console.countReset.bind(_console);
|
|
494
|
-
/**
|
|
495
|
-
* (Safe copy) Creates a new inline group in the console.
|
|
496
|
-
*/
|
|
497
|
-
_console.group.bind(_console);
|
|
498
|
-
/**
|
|
499
|
-
* (Safe copy) Creates a new inline group in the console that is initially collapsed.
|
|
500
|
-
*/
|
|
501
|
-
_console.groupCollapsed.bind(_console);
|
|
502
|
-
/**
|
|
503
|
-
* (Safe copy) Exits the current inline group.
|
|
504
|
-
*/
|
|
505
|
-
_console.groupEnd.bind(_console);
|
|
506
|
-
/**
|
|
507
|
-
* (Safe copy) Starts a timer with a name specified as an input parameter.
|
|
508
|
-
*/
|
|
509
|
-
_console.time.bind(_console);
|
|
510
|
-
/**
|
|
511
|
-
* (Safe copy) Stops a timer that was previously started.
|
|
512
|
-
*/
|
|
513
|
-
_console.timeEnd.bind(_console);
|
|
514
|
-
/**
|
|
515
|
-
* (Safe copy) Logs the current value of a timer that was previously started.
|
|
516
|
-
*/
|
|
517
|
-
_console.timeLog.bind(_console);
|
|
518
|
-
|
|
519
|
-
const registeredClasses = [];
|
|
520
|
-
|
|
521
|
-
/**
|
|
522
|
-
* Returns the data type of the target.
|
|
523
|
-
* Uses native `typeof` operator, however, makes distinction between `null`, `array`, and `object`.
|
|
524
|
-
* Also, when classes are registered via `registerClass`, it checks if objects are instance of any known registered class.
|
|
525
|
-
*
|
|
526
|
-
* @param target - The target to get the data type of.
|
|
527
|
-
* @returns The data type of the target.
|
|
528
|
-
*/
|
|
529
|
-
const getType = (target) => {
|
|
530
|
-
if (target === null)
|
|
531
|
-
return 'null';
|
|
532
|
-
const nativeDataType = typeof target;
|
|
533
|
-
if (nativeDataType === 'object') {
|
|
534
|
-
if (isArray(target))
|
|
535
|
-
return 'array';
|
|
536
|
-
for (const registeredClass of registeredClasses) {
|
|
537
|
-
if (target instanceof registeredClass)
|
|
538
|
-
return registeredClass.name;
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
return nativeDataType;
|
|
542
|
-
};
|
|
543
|
-
|
|
544
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
545
|
-
/**
|
|
546
|
-
* Creates a wrapper function that only executes the wrapped function if the condition function returns true.
|
|
547
|
-
*
|
|
548
|
-
* @param func - The function to be conditionally executed.
|
|
549
|
-
* @param conditionFunc - A function that returns a boolean, determining if `func` should be executed.
|
|
550
|
-
* @returns A wrapped version of `func` that executes conditionally.
|
|
551
|
-
*/
|
|
552
|
-
function createConditionalExecutionFunction(func, conditionFunc) {
|
|
553
|
-
return function (...args) {
|
|
554
|
-
if (conditionFunc()) {
|
|
555
|
-
return func(...args);
|
|
556
|
-
}
|
|
557
|
-
};
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
561
|
-
/**
|
|
562
|
-
* Creates a wrapper function that silently ignores any errors thrown by the wrapped void function.
|
|
563
|
-
* This function is specifically for wrapping functions that do not return a value (void functions).
|
|
564
|
-
* Exceptions are swallowed without any logging or handling.
|
|
565
|
-
*
|
|
566
|
-
* @param func - The void function to be wrapped.
|
|
567
|
-
* @returns A wrapped version of the input function that ignores errors.
|
|
568
|
-
*/
|
|
569
|
-
function createErrorIgnoringFunction(func) {
|
|
570
|
-
return function (...args) {
|
|
571
|
-
try {
|
|
572
|
-
func(...args);
|
|
573
|
-
}
|
|
574
|
-
catch {
|
|
575
|
-
// Deliberately swallowing/ignoring the exception
|
|
576
|
-
}
|
|
577
|
-
};
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
581
|
-
/**
|
|
582
|
-
* A no-operation function (noop) that does nothing regardless of the arguments passed.
|
|
583
|
-
* It is designed to be as permissive as possible in its typing without using the `Function` keyword.
|
|
584
|
-
*
|
|
585
|
-
* @param args - Any arguments passed to the function (ignored)
|
|
586
|
-
*/
|
|
587
|
-
const noop = (...args) => {
|
|
588
|
-
// Intentionally does nothing
|
|
589
|
-
};
|
|
590
|
-
|
|
591
|
-
const logLevels = ['none', 'error', 'warn', 'log', 'info', 'debug'];
|
|
592
|
-
const priority = {
|
|
593
|
-
error: 4,
|
|
594
|
-
warn: 3,
|
|
595
|
-
log: 2,
|
|
596
|
-
info: 1,
|
|
597
|
-
debug: 0,
|
|
598
|
-
};
|
|
599
|
-
/**
|
|
600
|
-
* Validates whether a given string is a valid log level.
|
|
601
|
-
*
|
|
602
|
-
* @param level - The log level to validate
|
|
603
|
-
* @returns True if the level is valid, false otherwise
|
|
604
|
-
*/
|
|
605
|
-
function isValidLogLevel(level) {
|
|
606
|
-
return logLevels.includes(level);
|
|
607
|
-
}
|
|
608
|
-
/**
|
|
609
|
-
* Creates a log level configuration manager for controlling logging behavior.
|
|
610
|
-
* Provides methods to get, set, and evaluate log levels based on priority.
|
|
611
|
-
*
|
|
612
|
-
* @param level - The initial log level (defaults to 'error')
|
|
613
|
-
* @returns A configuration object with log level management methods
|
|
614
|
-
* @throws {Error} When the provided level is not a valid log level
|
|
615
|
-
*/
|
|
616
|
-
function createLogLevelConfig(level = 'error') {
|
|
617
|
-
if (!isValidLogLevel(level)) {
|
|
618
|
-
throw createError('Cannot create log level configuration with a valid default log level');
|
|
619
|
-
}
|
|
620
|
-
const state = { level };
|
|
621
|
-
const getLogLevel = () => state.level;
|
|
622
|
-
const setLogLevel = (level) => {
|
|
623
|
-
if (!isValidLogLevel(level)) {
|
|
624
|
-
throw createError(`Cannot set value '${level}' level. Expected levels are ${logLevels}.`);
|
|
625
|
-
}
|
|
626
|
-
state.level = level;
|
|
627
|
-
};
|
|
628
|
-
const shouldLog = (level) => {
|
|
629
|
-
if (state.level === 'none' || level === 'none' || !isValidLogLevel(level)) {
|
|
630
|
-
return false;
|
|
631
|
-
}
|
|
632
|
-
return priority[level] >= priority[state.level];
|
|
633
|
-
};
|
|
634
|
-
return freeze({
|
|
635
|
-
getLogLevel,
|
|
636
|
-
setLogLevel,
|
|
637
|
-
shouldLog,
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
/**
|
|
642
|
-
* Creates a logger instance with configurable log level filtering.
|
|
643
|
-
* Each log function is wrapped to respect the current log level setting.
|
|
644
|
-
*
|
|
645
|
-
* @param error - Function to handle error-level logs (required)
|
|
646
|
-
* @param warn - Function to handle warning-level logs (optional, defaults to noop)
|
|
647
|
-
* @param log - Function to handle standard logs (optional, defaults to noop)
|
|
648
|
-
* @param info - Function to handle info-level logs (optional, defaults to noop)
|
|
649
|
-
* @param debug - Function to handle debug-level logs (optional, defaults to noop)
|
|
650
|
-
* @returns A frozen logger object with log methods and level control
|
|
651
|
-
* @throws {ErrorLevelFn} When any provided log function is invalid
|
|
652
|
-
*/
|
|
653
|
-
function createLogger(error, warn = noop, log = noop, info = noop, debug = noop) {
|
|
654
|
-
if (notValidLogFn(error)) {
|
|
655
|
-
throw createError(notFnMsg('error'));
|
|
656
|
-
}
|
|
657
|
-
if (notValidLogFn(warn)) {
|
|
658
|
-
throw createError(notFnMsg('warn'));
|
|
659
|
-
}
|
|
660
|
-
if (notValidLogFn(log)) {
|
|
661
|
-
throw createError(notFnMsg('log'));
|
|
662
|
-
}
|
|
663
|
-
if (notValidLogFn(info)) {
|
|
664
|
-
throw createError(notFnMsg('info'));
|
|
665
|
-
}
|
|
666
|
-
if (notValidLogFn(debug)) {
|
|
667
|
-
throw createError(notFnMsg('debug'));
|
|
668
|
-
}
|
|
669
|
-
const { setLogLevel, getLogLevel, shouldLog } = createLogLevelConfig();
|
|
670
|
-
const wrapLogFn = (fn, level) => {
|
|
671
|
-
if (fn === noop)
|
|
672
|
-
return fn;
|
|
673
|
-
const condition = () => shouldLog(level);
|
|
674
|
-
return createConditionalExecutionFunction(createErrorIgnoringFunction(fn), condition);
|
|
675
|
-
};
|
|
676
|
-
return freeze({
|
|
677
|
-
error: wrapLogFn(error, 'error'),
|
|
678
|
-
warn: wrapLogFn(warn, 'warn'),
|
|
679
|
-
log: wrapLogFn(log, 'log'),
|
|
680
|
-
info: wrapLogFn(info, 'info'),
|
|
681
|
-
debug: wrapLogFn(debug, 'debug'),
|
|
682
|
-
setLogLevel,
|
|
683
|
-
getLogLevel,
|
|
684
|
-
});
|
|
685
|
-
}
|
|
686
|
-
/**
|
|
687
|
-
* Validates whether a given value is a valid log function.
|
|
688
|
-
*
|
|
689
|
-
* @param fn - The value to validate
|
|
690
|
-
* @returns True if the value is not a function (invalid), false if it is valid
|
|
691
|
-
*/
|
|
692
|
-
function notValidLogFn(fn) {
|
|
693
|
-
return getType(fn) !== 'function' && fn !== noop;
|
|
694
|
-
}
|
|
695
|
-
/**
|
|
696
|
-
* Generates an error message for invalid log function parameters.
|
|
697
|
-
*
|
|
698
|
-
* @param label - The name of the log function that failed validation
|
|
699
|
-
* @returns A formatted error message string
|
|
700
|
-
*/
|
|
701
|
-
function notFnMsg(label) {
|
|
702
|
-
return `Cannot create a logger when ${label} is not a function`;
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
createLogger(error, warn, log, info, debug);
|
|
3
|
+
const node_path = require('node:path');
|
|
4
|
+
const index_cjs_js$2 = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/object/index.cjs.js');
|
|
5
|
+
const index_cjs_js$1 = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/map/index.cjs.js');
|
|
6
|
+
const index_cjs_js = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.cjs.js');
|
|
7
|
+
const node_fs = require('node:fs');
|
|
8
|
+
const index_cjs_js$5 = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/array/index.cjs.js');
|
|
9
|
+
const index_cjs_js$4 = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/console/index.cjs.js');
|
|
10
|
+
const index_cjs_js$6 = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/json/index.cjs.js');
|
|
11
|
+
const index_cjs_js$3 = require('../../_dependencies/@hyperfrontend/logging/index.cjs.js');
|
|
12
|
+
const index_cjs_js$7 = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.cjs.js');
|
|
13
|
+
const index_cjs_js$8 = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/number/index.cjs.js');
|
|
14
|
+
const { isSafePath } = require('../../_shared/core/fs/guard/index.cjs.js');
|
|
15
|
+
const { isDirectory, exists } = require('../../_shared/core/fs/stat/index.cjs.js');
|
|
16
|
+
const { createConfigError } = require('../../_shared/core/errors/structured-errors/index.cjs.js');
|
|
17
|
+
const { createCache } = require('../../_shared/core/cache/index.cjs.js');
|
|
18
|
+
const { matchGlobPattern } = require('../../_shared/core/patterns/glob/index.cjs.js');
|
|
19
|
+
const { CONFIG_PATTERNS, getConfigPatternsByType } = require('../../_shared/project/config/patterns/index.cjs.js');
|
|
706
20
|
|
|
707
21
|
/**
|
|
708
22
|
* Global log level registry.
|
|
709
23
|
* Tracks all created scoped loggers to allow global log level changes.
|
|
710
24
|
*/
|
|
711
|
-
const loggerRegistry = createSet();
|
|
25
|
+
const loggerRegistry = index_cjs_js.createSet();
|
|
712
26
|
/** Redacted placeholder for sensitive values */
|
|
713
27
|
const REDACTED = '[REDACTED]';
|
|
714
28
|
/**
|
|
@@ -742,17 +56,24 @@ function isSensitiveKey(key) {
|
|
|
742
56
|
*
|
|
743
57
|
* @param obj - Object to sanitize
|
|
744
58
|
* @returns New object with sensitive values redacted
|
|
59
|
+
*
|
|
60
|
+
* @example Sanitizing sensitive data
|
|
61
|
+
* ```typescript
|
|
62
|
+
* const config = { apiKey: 'secret123', endpoint: 'https://api.example.com' }
|
|
63
|
+
* const safe = sanitize(config)
|
|
64
|
+
* // => { apiKey: '[REDACTED]', endpoint: 'https://api.example.com' }
|
|
65
|
+
* ```
|
|
745
66
|
*/
|
|
746
67
|
function sanitize(obj) {
|
|
747
68
|
if (obj === null || obj === undefined) {
|
|
748
69
|
return obj;
|
|
749
70
|
}
|
|
750
|
-
if (isArray(obj)) {
|
|
71
|
+
if (index_cjs_js$5.isArray(obj)) {
|
|
751
72
|
return obj.map((item) => sanitize(item));
|
|
752
73
|
}
|
|
753
74
|
if (typeof obj === 'object') {
|
|
754
75
|
const result = {};
|
|
755
|
-
for (const [key, value] of entries(obj)) {
|
|
76
|
+
for (const [key, value] of index_cjs_js$2.entries(obj)) {
|
|
756
77
|
if (isSensitiveKey(key)) {
|
|
757
78
|
result[key] = REDACTED;
|
|
758
79
|
}
|
|
@@ -777,9 +98,9 @@ function sanitize(obj) {
|
|
|
777
98
|
*/
|
|
778
99
|
function formatMessage(namespace, message, meta) {
|
|
779
100
|
const prefix = `[${namespace}]`;
|
|
780
|
-
if (meta && keys(meta).length > 0) {
|
|
101
|
+
if (meta && index_cjs_js$2.keys(meta).length > 0) {
|
|
781
102
|
const sanitizedMeta = sanitize(meta);
|
|
782
|
-
return `${prefix} ${message} ${stringify(sanitizedMeta)}`;
|
|
103
|
+
return `${prefix} ${message} ${index_cjs_js$6.stringify(sanitizedMeta)}`;
|
|
783
104
|
}
|
|
784
105
|
return `${prefix} ${message}`;
|
|
785
106
|
}
|
|
@@ -792,7 +113,7 @@ function formatMessage(namespace, message, meta) {
|
|
|
792
113
|
* @param options - Logger configuration options
|
|
793
114
|
* @returns A configured scoped logger instance
|
|
794
115
|
*
|
|
795
|
-
* @example
|
|
116
|
+
* @example Creating a scoped logger
|
|
796
117
|
* ```typescript
|
|
797
118
|
* const logger = createScopedLogger('project-scope')
|
|
798
119
|
* logger.setLogLevel('debug')
|
|
@@ -811,9 +132,9 @@ function createScopedLogger(namespace, options = {}) {
|
|
|
811
132
|
const processedMeta = sanitizeSecrets && meta ? sanitize(meta) : meta;
|
|
812
133
|
baseFn(formatMessage(namespace, message, processedMeta));
|
|
813
134
|
};
|
|
814
|
-
const baseLogger = createLogger(createLogFn(error), createLogFn(warn), createLogFn(log), createLogFn(info), createLogFn(debug));
|
|
135
|
+
const baseLogger = index_cjs_js$3.createLogger(createLogFn(index_cjs_js$4.error), createLogFn(index_cjs_js$4.warn), createLogFn(index_cjs_js$4.log), createLogFn(index_cjs_js$4.info), createLogFn(index_cjs_js$4.debug));
|
|
815
136
|
baseLogger.setLogLevel(level);
|
|
816
|
-
const scopedLogger = freeze({
|
|
137
|
+
const scopedLogger = index_cjs_js$2.freeze({
|
|
817
138
|
error: (message, meta) => baseLogger.error(message, meta),
|
|
818
139
|
warn: (message, meta) => baseLogger.warn(message, meta),
|
|
819
140
|
log: (message, meta) => baseLogger.log(message, meta),
|
|
@@ -829,7 +150,7 @@ function createScopedLogger(namespace, options = {}) {
|
|
|
829
150
|
* Default logger instance for the project-scope library.
|
|
830
151
|
* Use this for general logging within the library.
|
|
831
152
|
*
|
|
832
|
-
* @example
|
|
153
|
+
* @example Using the default logger
|
|
833
154
|
* ```typescript
|
|
834
155
|
* import { logger } from '@hyperfrontend/project-scope/core'
|
|
835
156
|
*
|
|
@@ -847,10 +168,19 @@ const fsLogger = createScopedLogger('project-scope:fs');
|
|
|
847
168
|
* @param code - The category code for this type of filesystem failure
|
|
848
169
|
* @param context - Additional context including path, operation, and cause
|
|
849
170
|
* @returns A configured Error object with code and context properties
|
|
171
|
+
*
|
|
172
|
+
* @example Creating a file system error
|
|
173
|
+
* ```typescript
|
|
174
|
+
* throw createFileSystemError(
|
|
175
|
+
* 'Cannot read file',
|
|
176
|
+
* 'FS_READ_ERROR',
|
|
177
|
+
* { path: './missing.txt', operation: 'read' }
|
|
178
|
+
* )
|
|
179
|
+
* ```
|
|
850
180
|
*/
|
|
851
181
|
function createFileSystemError(message, code, context) {
|
|
852
|
-
const error = createError(message);
|
|
853
|
-
defineProperties(error, {
|
|
182
|
+
const error = index_cjs_js$7.createError(message);
|
|
183
|
+
index_cjs_js$2.defineProperties(error, {
|
|
854
184
|
code: { value: code, enumerable: true },
|
|
855
185
|
context: { value: context, enumerable: true },
|
|
856
186
|
});
|
|
@@ -864,7 +194,7 @@ function createFileSystemError(message, code, context) {
|
|
|
864
194
|
* @returns File contents as string
|
|
865
195
|
* @throws {Error} If file doesn't exist or can't be read
|
|
866
196
|
*
|
|
867
|
-
* @example
|
|
197
|
+
* @example Reading file contents
|
|
868
198
|
* ```typescript
|
|
869
199
|
* import { readFileContent } from '@hyperfrontend/project-scope'
|
|
870
200
|
*
|
|
@@ -873,6 +203,9 @@ function createFileSystemError(message, code, context) {
|
|
|
873
203
|
* ```
|
|
874
204
|
*/
|
|
875
205
|
function readFileContent(filePath, encoding = 'utf-8') {
|
|
206
|
+
if (!isSafePath(filePath)) {
|
|
207
|
+
throw createFileSystemError(`Unsafe file path: ${filePath}`, 'FS_READ_ERROR', { path: filePath, operation: 'read' });
|
|
208
|
+
}
|
|
876
209
|
if (!node_fs.existsSync(filePath)) {
|
|
877
210
|
fsLogger.debug('File not found', { path: filePath });
|
|
878
211
|
throw createFileSystemError(`File not found: ${filePath}`, 'FS_NOT_FOUND', { path: filePath, operation: 'read' });
|
|
@@ -891,9 +224,17 @@ function readFileContent(filePath, encoding = 'utf-8') {
|
|
|
891
224
|
* @param filePath - Path to file
|
|
892
225
|
* @param encoding - File encoding (default: utf-8)
|
|
893
226
|
* @returns File contents or null if file doesn't exist
|
|
227
|
+
*
|
|
228
|
+
* @example Reading file if it exists
|
|
229
|
+
* ```typescript
|
|
230
|
+
* const content = readFileIfExists('./optional-config.json')
|
|
231
|
+
* if (content) {
|
|
232
|
+
* // File existed, use content
|
|
233
|
+
* }
|
|
234
|
+
* ```
|
|
894
235
|
*/
|
|
895
236
|
function readFileIfExists(filePath, encoding = 'utf-8') {
|
|
896
|
-
if (!node_fs.existsSync(filePath)) {
|
|
237
|
+
if (!isSafePath(filePath) || !node_fs.existsSync(filePath)) {
|
|
897
238
|
return null;
|
|
898
239
|
}
|
|
899
240
|
try {
|
|
@@ -904,56 +245,6 @@ function readFileIfExists(filePath, encoding = 'utf-8') {
|
|
|
904
245
|
}
|
|
905
246
|
}
|
|
906
247
|
|
|
907
|
-
createScopedLogger('project-scope:fs:write');
|
|
908
|
-
|
|
909
|
-
/**
|
|
910
|
-
* Get file stats with error handling.
|
|
911
|
-
*
|
|
912
|
-
* @param filePath - Path to file
|
|
913
|
-
* @param followSymlinks - Whether to follow symlinks (default: true)
|
|
914
|
-
* @returns File stats or null if path doesn't exist
|
|
915
|
-
*/
|
|
916
|
-
function getFileStat(filePath, followSymlinks = true) {
|
|
917
|
-
if (!node_fs.existsSync(filePath)) {
|
|
918
|
-
return null;
|
|
919
|
-
}
|
|
920
|
-
try {
|
|
921
|
-
const stat = followSymlinks ? node_fs.statSync(filePath) : node_fs.lstatSync(filePath);
|
|
922
|
-
return {
|
|
923
|
-
isFile: stat.isFile(),
|
|
924
|
-
isDirectory: stat.isDirectory(),
|
|
925
|
-
isSymlink: stat.isSymbolicLink(),
|
|
926
|
-
size: stat.size,
|
|
927
|
-
created: stat.birthtime,
|
|
928
|
-
modified: stat.mtime,
|
|
929
|
-
accessed: stat.atime,
|
|
930
|
-
mode: stat.mode,
|
|
931
|
-
};
|
|
932
|
-
}
|
|
933
|
-
catch {
|
|
934
|
-
return null;
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
/**
|
|
938
|
-
* Check if path is a directory.
|
|
939
|
-
*
|
|
940
|
-
* @param dirPath - Path to check
|
|
941
|
-
* @returns True if path is a directory
|
|
942
|
-
*/
|
|
943
|
-
function isDirectory(dirPath) {
|
|
944
|
-
const stats = getFileStat(dirPath);
|
|
945
|
-
return stats?.isDirectory ?? false;
|
|
946
|
-
}
|
|
947
|
-
/**
|
|
948
|
-
* Check if path exists.
|
|
949
|
-
*
|
|
950
|
-
* @param filePath - Path to check
|
|
951
|
-
* @returns True if path exists
|
|
952
|
-
*/
|
|
953
|
-
function exists(filePath) {
|
|
954
|
-
return node_fs.existsSync(filePath);
|
|
955
|
-
}
|
|
956
|
-
|
|
957
248
|
const fsDirLogger = createScopedLogger('project-scope:fs:dir');
|
|
958
249
|
/**
|
|
959
250
|
* List immediate contents of a directory.
|
|
@@ -962,7 +253,7 @@ const fsDirLogger = createScopedLogger('project-scope:fs:dir');
|
|
|
962
253
|
* @returns Array of entries with metadata for each file/directory
|
|
963
254
|
* @throws {Error} If directory doesn't exist or isn't a directory
|
|
964
255
|
*
|
|
965
|
-
* @example
|
|
256
|
+
* @example Listing directory contents
|
|
966
257
|
* ```typescript
|
|
967
258
|
* import { readDirectory } from '@hyperfrontend/project-scope'
|
|
968
259
|
*
|
|
@@ -1005,197 +296,7 @@ function readDirectory(dirPath) {
|
|
|
1005
296
|
|
|
1006
297
|
createScopedLogger('project-scope:fs:traversal');
|
|
1007
298
|
|
|
1008
|
-
|
|
1009
|
-
* Match path against glob pattern using safe character iteration.
|
|
1010
|
-
* Avoids regex to prevent ReDoS attacks.
|
|
1011
|
-
*
|
|
1012
|
-
* Supported patterns:
|
|
1013
|
-
* - * matches any characters except /
|
|
1014
|
-
* - ** matches any characters including /
|
|
1015
|
-
* - ? matches exactly one character except /
|
|
1016
|
-
* - {a,b,c} matches any of the alternatives
|
|
1017
|
-
*
|
|
1018
|
-
* @param path - The filesystem path to test against the pattern
|
|
1019
|
-
* @param pattern - The glob pattern to match against
|
|
1020
|
-
* @returns True if path matches pattern
|
|
1021
|
-
*
|
|
1022
|
-
* @example
|
|
1023
|
-
* ```typescript
|
|
1024
|
-
* import { matchGlobPattern } from '@hyperfrontend/project-scope'
|
|
1025
|
-
*
|
|
1026
|
-
* matchGlobPattern('src/utils/helper.ts', '\*\*\/*.ts') // true
|
|
1027
|
-
* matchGlobPattern('test.spec.ts', '\*.spec.ts') // true
|
|
1028
|
-
* matchGlobPattern('config.json', '\*.{json,yaml}') // true
|
|
1029
|
-
* matchGlobPattern('src/index.ts', 'src/\*.ts') // true
|
|
1030
|
-
* ```
|
|
1031
|
-
*/
|
|
1032
|
-
function matchGlobPattern(path, pattern) {
|
|
1033
|
-
return matchSegments(path.split('/'), pattern.split('/'), 0, 0);
|
|
1034
|
-
}
|
|
1035
|
-
/**
|
|
1036
|
-
* Internal recursive function to match path segments against pattern segments.
|
|
1037
|
-
*
|
|
1038
|
-
* @param pathParts - Array of path segments split by '/'
|
|
1039
|
-
* @param patternParts - Array of pattern segments split by '/'
|
|
1040
|
-
* @param pathIdx - Current index in pathParts being examined
|
|
1041
|
-
* @param patternIdx - Current index in patternParts being examined
|
|
1042
|
-
* @returns True if remaining segments match
|
|
1043
|
-
*/
|
|
1044
|
-
function matchSegments(pathParts, patternParts, pathIdx, patternIdx) {
|
|
1045
|
-
if (pathIdx === pathParts.length && patternIdx === patternParts.length) {
|
|
1046
|
-
return true;
|
|
1047
|
-
}
|
|
1048
|
-
if (patternIdx >= patternParts.length) {
|
|
1049
|
-
return false;
|
|
1050
|
-
}
|
|
1051
|
-
const patternPart = patternParts[patternIdx];
|
|
1052
|
-
if (patternPart === '**') {
|
|
1053
|
-
for (let i = pathIdx; i <= pathParts.length; i++) {
|
|
1054
|
-
if (matchSegments(pathParts, patternParts, i, patternIdx + 1)) {
|
|
1055
|
-
return true;
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
return false;
|
|
1059
|
-
}
|
|
1060
|
-
if (pathIdx >= pathParts.length) {
|
|
1061
|
-
return false;
|
|
1062
|
-
}
|
|
1063
|
-
const pathPart = pathParts[pathIdx];
|
|
1064
|
-
if (matchSegment(pathPart, patternPart)) {
|
|
1065
|
-
return matchSegments(pathParts, patternParts, pathIdx + 1, patternIdx + 1);
|
|
1066
|
-
}
|
|
1067
|
-
return false;
|
|
1068
|
-
}
|
|
1069
|
-
/**
|
|
1070
|
-
* Match a single path segment against a pattern segment.
|
|
1071
|
-
* Handles *, ?, and {a,b,c} patterns.
|
|
1072
|
-
*
|
|
1073
|
-
* @param text - The path segment text to match
|
|
1074
|
-
* @param pattern - The pattern segment to match against
|
|
1075
|
-
* @returns True if the text matches the pattern
|
|
1076
|
-
*/
|
|
1077
|
-
function matchSegment(text, pattern) {
|
|
1078
|
-
let textIdx = 0;
|
|
1079
|
-
let patternIdx = 0;
|
|
1080
|
-
while (patternIdx < pattern.length) {
|
|
1081
|
-
const char = pattern[patternIdx];
|
|
1082
|
-
if (char === '*') {
|
|
1083
|
-
patternIdx++;
|
|
1084
|
-
if (patternIdx === pattern.length) {
|
|
1085
|
-
return true;
|
|
1086
|
-
}
|
|
1087
|
-
for (let i = textIdx; i <= text.length; i++) {
|
|
1088
|
-
if (matchSegmentFrom(text, i, pattern, patternIdx)) {
|
|
1089
|
-
return true;
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
return false;
|
|
1093
|
-
}
|
|
1094
|
-
else if (char === '?') {
|
|
1095
|
-
if (textIdx >= text.length) {
|
|
1096
|
-
return false;
|
|
1097
|
-
}
|
|
1098
|
-
textIdx++;
|
|
1099
|
-
patternIdx++;
|
|
1100
|
-
}
|
|
1101
|
-
else if (char === '{') {
|
|
1102
|
-
const closeIdx = findClosingBrace(pattern, patternIdx);
|
|
1103
|
-
if (closeIdx === -1) {
|
|
1104
|
-
if (textIdx >= text.length || text[textIdx] !== char) {
|
|
1105
|
-
return false;
|
|
1106
|
-
}
|
|
1107
|
-
textIdx++;
|
|
1108
|
-
patternIdx++;
|
|
1109
|
-
}
|
|
1110
|
-
else {
|
|
1111
|
-
const alternatives = extractAlternatives(pattern.slice(patternIdx + 1, closeIdx));
|
|
1112
|
-
for (const alt of alternatives) {
|
|
1113
|
-
if (matchSegmentFrom(text, textIdx, text.slice(0, textIdx) + alt + pattern.slice(closeIdx + 1), textIdx)) {
|
|
1114
|
-
return true;
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
return false;
|
|
1118
|
-
}
|
|
1119
|
-
}
|
|
1120
|
-
else {
|
|
1121
|
-
if (textIdx >= text.length || text[textIdx] !== char) {
|
|
1122
|
-
return false;
|
|
1123
|
-
}
|
|
1124
|
-
textIdx++;
|
|
1125
|
-
patternIdx++;
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
return textIdx === text.length;
|
|
1129
|
-
}
|
|
1130
|
-
/**
|
|
1131
|
-
* Helper to match from a specific position.
|
|
1132
|
-
*
|
|
1133
|
-
* @param text - The full text being matched
|
|
1134
|
-
* @param textIdx - The starting index in text to match from
|
|
1135
|
-
* @param pattern - The full pattern being matched
|
|
1136
|
-
* @param patternIdx - The starting index in pattern to match from
|
|
1137
|
-
* @returns True if the text matches the pattern from the given positions
|
|
1138
|
-
*/
|
|
1139
|
-
function matchSegmentFrom(text, textIdx, pattern, patternIdx) {
|
|
1140
|
-
const remainingText = text.slice(textIdx);
|
|
1141
|
-
const remainingPattern = pattern.slice(patternIdx);
|
|
1142
|
-
return matchSegment(remainingText, remainingPattern);
|
|
1143
|
-
}
|
|
1144
|
-
/**
|
|
1145
|
-
* Find closing brace for {a,b,c} pattern.
|
|
1146
|
-
*
|
|
1147
|
-
* @param pattern - The pattern string to search within
|
|
1148
|
-
* @param startIdx - The index of the opening brace
|
|
1149
|
-
* @returns The index of the matching closing brace, or -1 if not found
|
|
1150
|
-
*/
|
|
1151
|
-
function findClosingBrace(pattern, startIdx) {
|
|
1152
|
-
let depth = 0;
|
|
1153
|
-
for (let i = startIdx; i < pattern.length; i++) {
|
|
1154
|
-
if (pattern[i] === '{') {
|
|
1155
|
-
depth++;
|
|
1156
|
-
}
|
|
1157
|
-
else if (pattern[i] === '}') {
|
|
1158
|
-
depth--;
|
|
1159
|
-
if (depth === 0) {
|
|
1160
|
-
return i;
|
|
1161
|
-
}
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
return -1;
|
|
1165
|
-
}
|
|
1166
|
-
/**
|
|
1167
|
-
* Extract alternatives from {a,b,c} pattern content.
|
|
1168
|
-
*
|
|
1169
|
-
* @param content - The content between braces (without the braces themselves)
|
|
1170
|
-
* @returns Array of alternative strings split by commas at depth 0
|
|
1171
|
-
*/
|
|
1172
|
-
function extractAlternatives(content) {
|
|
1173
|
-
const alternatives = [];
|
|
1174
|
-
let current = '';
|
|
1175
|
-
let depth = 0;
|
|
1176
|
-
for (let i = 0; i < content.length; i++) {
|
|
1177
|
-
const char = content[i];
|
|
1178
|
-
if (char === '{') {
|
|
1179
|
-
depth++;
|
|
1180
|
-
current += char;
|
|
1181
|
-
}
|
|
1182
|
-
else if (char === '}') {
|
|
1183
|
-
depth--;
|
|
1184
|
-
current += char;
|
|
1185
|
-
}
|
|
1186
|
-
else if (char === ',' && depth === 0) {
|
|
1187
|
-
alternatives.push(current);
|
|
1188
|
-
current = '';
|
|
1189
|
-
}
|
|
1190
|
-
else {
|
|
1191
|
-
current += char;
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
if (current) {
|
|
1195
|
-
alternatives.push(current);
|
|
1196
|
-
}
|
|
1197
|
-
return alternatives;
|
|
1198
|
-
}
|
|
299
|
+
createScopedLogger('project-scope:fs:write');
|
|
1199
300
|
|
|
1200
301
|
const walkLogger = createScopedLogger('project-scope:project:walk');
|
|
1201
302
|
/**
|
|
@@ -1262,6 +363,18 @@ function matchPattern(path, pattern) {
|
|
|
1262
363
|
* @param startPath - Root directory to begin traversal
|
|
1263
364
|
* @param visitor - Callback function invoked for each file system entry
|
|
1264
365
|
* @param options - Configuration for traversal behavior
|
|
366
|
+
*
|
|
367
|
+
* @example Walking a directory tree
|
|
368
|
+
* ```typescript
|
|
369
|
+
* import { walkDirectory } from '@hyperfrontend/project-scope'
|
|
370
|
+
*
|
|
371
|
+
* const tsFiles: string[] = []
|
|
372
|
+
* walkDirectory('./src', (entry) => {
|
|
373
|
+
* if (entry.isFile && entry.name.endsWith('.ts')) {
|
|
374
|
+
* tsFiles.push(entry.relativePath)
|
|
375
|
+
* }
|
|
376
|
+
* }, { maxDepth: 5, respectGitignore: true })
|
|
377
|
+
* ```
|
|
1265
378
|
*/
|
|
1266
379
|
function walkDirectory(startPath, visitor, options) {
|
|
1267
380
|
walkLogger.debug('Starting directory walk', {
|
|
@@ -1358,7 +471,7 @@ function matchesPatterns(path, patterns) {
|
|
|
1358
471
|
* @param options - Configuration for search behavior
|
|
1359
472
|
* @returns List of relative file paths that match the patterns
|
|
1360
473
|
*
|
|
1361
|
-
* @example
|
|
474
|
+
* @example Finding files by pattern
|
|
1362
475
|
* ```typescript
|
|
1363
476
|
* import { findFiles } from '@hyperfrontend/project-scope'
|
|
1364
477
|
*
|
|
@@ -1376,7 +489,7 @@ function matchesPatterns(path, patterns) {
|
|
|
1376
489
|
* ```
|
|
1377
490
|
*/
|
|
1378
491
|
function findFiles(startPath, patterns, options) {
|
|
1379
|
-
const normalizedPatterns = isArray(patterns) ? patterns : [patterns];
|
|
492
|
+
const normalizedPatterns = index_cjs_js$5.isArray(patterns) ? patterns : [patterns];
|
|
1380
493
|
searchLogger.debug('Finding files', { startPath, patterns: normalizedPatterns, maxResults: options?.maxResults });
|
|
1381
494
|
const results = [];
|
|
1382
495
|
const maxResults = options?.maxResults ?? Infinity;
|
|
@@ -1413,7 +526,7 @@ const configDetectionCache = createCache({ ttl: 30000, maxSize: 50 });
|
|
|
1413
526
|
* @param options - Detection options
|
|
1414
527
|
* @returns Array of detected configuration files
|
|
1415
528
|
*
|
|
1416
|
-
* @example
|
|
529
|
+
* @example Detecting configuration files
|
|
1417
530
|
* ```typescript
|
|
1418
531
|
* import { detectConfigs } from '@hyperfrontend/project-scope'
|
|
1419
532
|
*
|
|
@@ -1432,7 +545,7 @@ const configDetectionCache = createCache({ ttl: 30000, maxSize: 50 });
|
|
|
1432
545
|
* ```
|
|
1433
546
|
*/
|
|
1434
547
|
function detectConfigs(rootPath, types, options) {
|
|
1435
|
-
const typesToCheck = types ?? keys(CONFIG_PATTERNS);
|
|
548
|
+
const typesToCheck = types ?? index_cjs_js$2.keys(CONFIG_PATTERNS);
|
|
1436
549
|
const results = [];
|
|
1437
550
|
const maxDepth = options?.maxDepth ?? 10;
|
|
1438
551
|
const includeHidden = options?.includeHidden ?? true;
|
|
@@ -1493,6 +606,14 @@ function detectConfigs(rootPath, types, options) {
|
|
|
1493
606
|
* Clear the config detection cache.
|
|
1494
607
|
*
|
|
1495
608
|
* Useful for testing or when the project files have changed.
|
|
609
|
+
*
|
|
610
|
+
* @example Clearing the config detection cache
|
|
611
|
+
* ```typescript
|
|
612
|
+
* import { clearConfigDetectionCache } from '@hyperfrontend/project-scope'
|
|
613
|
+
*
|
|
614
|
+
* // Reset cache after modifying config files
|
|
615
|
+
* clearConfigDetectionCache()
|
|
616
|
+
* ```
|
|
1496
617
|
*/
|
|
1497
618
|
function clearConfigDetectionCache() {
|
|
1498
619
|
configDetectionCache.clear();
|
|
@@ -1503,6 +624,17 @@ function clearConfigDetectionCache() {
|
|
|
1503
624
|
* @param rootPath - Project root directory
|
|
1504
625
|
* @param type - Config type to find
|
|
1505
626
|
* @returns Full path to config file or null if not found
|
|
627
|
+
*
|
|
628
|
+
* @example Finding a specific config file
|
|
629
|
+
* ```typescript
|
|
630
|
+
* import { findConfigFile } from '@hyperfrontend/project-scope'
|
|
631
|
+
*
|
|
632
|
+
* const tsConfig = findConfigFile('/project', 'typescript')
|
|
633
|
+
* // => '/project/tsconfig.json'
|
|
634
|
+
*
|
|
635
|
+
* const eslint = findConfigFile('/project', 'eslint')
|
|
636
|
+
* // => '/project/.eslintrc.js' or null if not found
|
|
637
|
+
* ```
|
|
1506
638
|
*/
|
|
1507
639
|
function findConfigFile(rootPath, type) {
|
|
1508
640
|
const info = CONFIG_PATTERNS[type];
|
|
@@ -1526,72 +658,6 @@ function findConfigFile(rootPath, type) {
|
|
|
1526
658
|
}
|
|
1527
659
|
return null;
|
|
1528
660
|
}
|
|
1529
|
-
/**
|
|
1530
|
-
* Get all known config file patterns for a given configuration type.
|
|
1531
|
-
*
|
|
1532
|
-
* @param type - Configuration type identifier
|
|
1533
|
-
* @returns Array of glob patterns for matching config files
|
|
1534
|
-
*/
|
|
1535
|
-
function getConfigPaths(type) {
|
|
1536
|
-
const info = CONFIG_PATTERNS[type];
|
|
1537
|
-
return info?.patterns ?? [];
|
|
1538
|
-
}
|
|
1539
|
-
|
|
1540
|
-
/**
|
|
1541
|
-
* Safe copies of Number built-in methods and constants.
|
|
1542
|
-
*
|
|
1543
|
-
* These references are captured at module initialization time to protect against
|
|
1544
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
1545
|
-
*
|
|
1546
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/number
|
|
1547
|
-
*/
|
|
1548
|
-
const _parseInt = globalThis.parseInt;
|
|
1549
|
-
const _parseFloat = globalThis.parseFloat;
|
|
1550
|
-
/**
|
|
1551
|
-
* (Safe copy) Parses a string and returns an integer.
|
|
1552
|
-
*/
|
|
1553
|
-
const parseInt = _parseInt;
|
|
1554
|
-
/**
|
|
1555
|
-
* (Safe copy) Parses a string and returns a floating point number.
|
|
1556
|
-
*/
|
|
1557
|
-
const parseFloat = _parseFloat;
|
|
1558
|
-
|
|
1559
|
-
/**
|
|
1560
|
-
* Create a structured error with code and optional context.
|
|
1561
|
-
*
|
|
1562
|
-
* @param message - The human-readable error message
|
|
1563
|
-
* @param code - The machine-readable error code for programmatic handling
|
|
1564
|
-
* @param context - Additional contextual information about the error
|
|
1565
|
-
* @returns Structured error instance with code and context properties
|
|
1566
|
-
*
|
|
1567
|
-
* @example
|
|
1568
|
-
* ```typescript
|
|
1569
|
-
* import { createStructuredError } from '@hyperfrontend/project-scope'
|
|
1570
|
-
*
|
|
1571
|
-
* throw createStructuredError(
|
|
1572
|
-
* 'Configuration file not found',
|
|
1573
|
-
* 'CONFIG_NOT_FOUND',
|
|
1574
|
-
* { path: './config.json', searched: ['./config.json', './settings.json'] }
|
|
1575
|
-
* )
|
|
1576
|
-
* ```
|
|
1577
|
-
*/
|
|
1578
|
-
function createStructuredError(message, code, context) {
|
|
1579
|
-
const error = createError(message);
|
|
1580
|
-
error.code = code;
|
|
1581
|
-
error.context = context ?? {};
|
|
1582
|
-
return error;
|
|
1583
|
-
}
|
|
1584
|
-
/**
|
|
1585
|
-
* Create a configuration-related error.
|
|
1586
|
-
*
|
|
1587
|
-
* @param message - The human-readable error message
|
|
1588
|
-
* @param code - The machine-readable error code for programmatic handling
|
|
1589
|
-
* @param context - Additional contextual information (e.g., file path, config key)
|
|
1590
|
-
* @returns Structured error instance tagged with type 'config'
|
|
1591
|
-
*/
|
|
1592
|
-
function createConfigError(message, code, context) {
|
|
1593
|
-
return createStructuredError(message, code, { ...context, type: 'config' });
|
|
1594
|
-
}
|
|
1595
661
|
|
|
1596
662
|
/**
|
|
1597
663
|
* Detect config type from file name.
|
|
@@ -1602,7 +668,7 @@ function createConfigError(message, code, context) {
|
|
|
1602
668
|
*/
|
|
1603
669
|
function detectConfigType(filePath) {
|
|
1604
670
|
const fileName = node_path.basename(filePath);
|
|
1605
|
-
for (const [type, info] of entries(CONFIG_PATTERNS)) {
|
|
671
|
+
for (const [type, info] of index_cjs_js$2.entries(CONFIG_PATTERNS)) {
|
|
1606
672
|
for (const pattern of info.patterns) {
|
|
1607
673
|
if (matchGlobPattern(fileName, pattern)) {
|
|
1608
674
|
return type;
|
|
@@ -1723,10 +789,10 @@ function parseSimpleYaml(content) {
|
|
|
1723
789
|
result[key] = null;
|
|
1724
790
|
}
|
|
1725
791
|
else if (/^-?\d+$/.test(value)) {
|
|
1726
|
-
result[key] = parseInt(value, 10);
|
|
792
|
+
result[key] = index_cjs_js$8.parseInt(value, 10);
|
|
1727
793
|
}
|
|
1728
794
|
else if (/^-?\d+\.\d+$/.test(value)) {
|
|
1729
|
-
result[key] = parseFloat(value);
|
|
795
|
+
result[key] = index_cjs_js$8.parseFloat(value);
|
|
1730
796
|
}
|
|
1731
797
|
else {
|
|
1732
798
|
result[key] = value.replace(/^["']|["']$/g, '');
|
|
@@ -1804,16 +870,28 @@ function parseDotenv(content) {
|
|
|
1804
870
|
* @param type - Category of configuration (e.g., typescript, eslint)
|
|
1805
871
|
* @param format - Whether to strip comments (jsonc) or parse strictly (json)
|
|
1806
872
|
* @returns Configuration object with parsed data and extends references
|
|
873
|
+
*
|
|
874
|
+
* @example Parsing JSON configuration
|
|
875
|
+
* ```typescript
|
|
876
|
+
* import { parseJsonConfig } from '@hyperfrontend/project-scope'
|
|
877
|
+
*
|
|
878
|
+
* const config = parseJsonConfig(
|
|
879
|
+
* 'tsconfig.json',
|
|
880
|
+
* '{ "extends": "./base.json", "compilerOptions": {} }',
|
|
881
|
+
* 'typescript'
|
|
882
|
+
* )
|
|
883
|
+
* // => { type: 'typescript', path: 'tsconfig.json', data: {...}, extends: ['./base.json'] }
|
|
884
|
+
* ```
|
|
1807
885
|
*/
|
|
1808
886
|
function parseJsonConfig(filePath, content, type, format = 'json') {
|
|
1809
887
|
const cleanContent = format === 'jsonc' ? stripJsonComments(content) : content;
|
|
1810
888
|
try {
|
|
1811
|
-
const data = parse(cleanContent);
|
|
889
|
+
const data = index_cjs_js$6.parse(cleanContent);
|
|
1812
890
|
let extendsPath;
|
|
1813
891
|
if (typeof data['extends'] === 'string') {
|
|
1814
892
|
extendsPath = [data['extends']];
|
|
1815
893
|
}
|
|
1816
|
-
else if (isArray(data['extends'])) {
|
|
894
|
+
else if (index_cjs_js$5.isArray(data['extends'])) {
|
|
1817
895
|
extendsPath = data['extends'];
|
|
1818
896
|
}
|
|
1819
897
|
return {
|
|
@@ -1839,6 +917,14 @@ function parseJsonConfig(filePath, content, type, format = 'json') {
|
|
|
1839
917
|
* @param content - Raw file content to parse
|
|
1840
918
|
* @param type - Category of configuration (e.g., github-actions, docker-compose)
|
|
1841
919
|
* @returns Configuration object with parsed YAML data
|
|
920
|
+
*
|
|
921
|
+
* @example Parsing YAML configuration
|
|
922
|
+
* ```typescript
|
|
923
|
+
* import { parseYamlConfig } from '@hyperfrontend/project-scope'
|
|
924
|
+
*
|
|
925
|
+
* const config = parseYamlConfig('.github/workflows/ci.yml', yamlContent, 'github-actions')
|
|
926
|
+
* // => { type: 'github-actions', path: '...', format: 'yaml', data: {...} }
|
|
927
|
+
* ```
|
|
1842
928
|
*/
|
|
1843
929
|
function parseYamlConfig(filePath, content, type) {
|
|
1844
930
|
const data = parseSimpleYaml(content);
|
|
@@ -1855,6 +941,14 @@ function parseYamlConfig(filePath, content, type) {
|
|
|
1855
941
|
* @param filePath - Path to config file
|
|
1856
942
|
* @param type - Optional config type (auto-detected if not provided)
|
|
1857
943
|
* @returns Parsed configuration
|
|
944
|
+
*
|
|
945
|
+
* @example Parsing a configuration file
|
|
946
|
+
* ```typescript
|
|
947
|
+
* import { parseConfig } from '@hyperfrontend/project-scope'
|
|
948
|
+
*
|
|
949
|
+
* const tsConfig = parseConfig('/project/tsconfig.json')
|
|
950
|
+
* const eslintConfig = parseConfig('/project/.eslintrc.yml', 'eslint')
|
|
951
|
+
* ```
|
|
1858
952
|
*/
|
|
1859
953
|
function parseConfig(filePath, type) {
|
|
1860
954
|
const content = readFileContent(filePath);
|
|
@@ -1899,42 +993,12 @@ function parseConfig(filePath, type) {
|
|
|
1899
993
|
};
|
|
1900
994
|
}
|
|
1901
995
|
}
|
|
1902
|
-
/**
|
|
1903
|
-
* Read and parse config file if it exists.
|
|
1904
|
-
*
|
|
1905
|
-
* @param configPath - Path to config file
|
|
1906
|
-
* @returns Parsed config or null if file doesn't exist
|
|
1907
|
-
*/
|
|
1908
|
-
function readConfigIfExists(configPath) {
|
|
1909
|
-
const content = readFileIfExists(configPath);
|
|
1910
|
-
if (!content)
|
|
1911
|
-
return null;
|
|
1912
|
-
try {
|
|
1913
|
-
const format = detectFormat(configPath);
|
|
1914
|
-
switch (format) {
|
|
1915
|
-
case 'json':
|
|
1916
|
-
return parse(content);
|
|
1917
|
-
case 'jsonc':
|
|
1918
|
-
return parse(stripJsonComments(content));
|
|
1919
|
-
case 'yaml':
|
|
1920
|
-
return parseSimpleYaml(content);
|
|
1921
|
-
default:
|
|
1922
|
-
return null;
|
|
1923
|
-
}
|
|
1924
|
-
}
|
|
1925
|
-
catch {
|
|
1926
|
-
return null;
|
|
1927
|
-
}
|
|
1928
|
-
}
|
|
1929
996
|
|
|
1930
997
|
exports.CONFIG_PATTERNS = CONFIG_PATTERNS;
|
|
1931
998
|
exports.clearConfigDetectionCache = clearConfigDetectionCache;
|
|
1932
999
|
exports.detectConfigs = detectConfigs;
|
|
1933
1000
|
exports.findConfigFile = findConfigFile;
|
|
1934
|
-
exports.getConfigPaths = getConfigPaths;
|
|
1935
1001
|
exports.getConfigPatternsByType = getConfigPatternsByType;
|
|
1936
1002
|
exports.parseConfig = parseConfig;
|
|
1937
1003
|
exports.parseJsonConfig = parseJsonConfig;
|
|
1938
1004
|
exports.parseYamlConfig = parseYamlConfig;
|
|
1939
|
-
exports.readConfigIfExists = readConfigIfExists;
|
|
1940
|
-
//# sourceMappingURL=index.cjs.js.map
|