@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,541 +1,25 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* and prevents the addition of new properties.
|
|
18
|
-
*/
|
|
19
|
-
const freeze = _Object.freeze;
|
|
20
|
-
/**
|
|
21
|
-
* (Safe copy) Returns the names of the enumerable string properties and methods of an object.
|
|
22
|
-
*/
|
|
23
|
-
const keys = _Object.keys;
|
|
24
|
-
/**
|
|
25
|
-
* (Safe copy) Returns an array of key/values of the enumerable own properties of an object.
|
|
26
|
-
*/
|
|
27
|
-
const entries = _Object.entries;
|
|
28
|
-
/**
|
|
29
|
-
* (Safe copy) Returns an array of values of the enumerable own properties of an object.
|
|
30
|
-
*/
|
|
31
|
-
const values = _Object.values;
|
|
32
|
-
/**
|
|
33
|
-
* (Safe copy) Adds one or more properties to an object, and/or modifies attributes of existing properties.
|
|
34
|
-
*/
|
|
35
|
-
const defineProperties = _Object.defineProperties;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Safe copies of Map built-in via factory function.
|
|
39
|
-
*
|
|
40
|
-
* Since constructors cannot be safely captured via Object.assign, this module
|
|
41
|
-
* provides a factory function that uses Reflect.construct internally.
|
|
42
|
-
*
|
|
43
|
-
* These references are captured at module initialization time to protect against
|
|
44
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
45
|
-
*
|
|
46
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/map
|
|
47
|
-
*/
|
|
48
|
-
const _Map = globalThis.Map;
|
|
49
|
-
const _Reflect$2 = globalThis.Reflect;
|
|
50
|
-
/**
|
|
51
|
-
* (Safe copy) Creates a new Map using the captured Map constructor.
|
|
52
|
-
* Use this instead of `new Map()`.
|
|
53
|
-
*
|
|
54
|
-
* @param iterable - Optional iterable of key-value pairs.
|
|
55
|
-
* @returns A new Map instance.
|
|
56
|
-
*/
|
|
57
|
-
const createMap = (iterable) => _Reflect$2.construct(_Map, iterable ? [iterable] : []);
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Safe copies of Set built-in via factory function.
|
|
61
|
-
*
|
|
62
|
-
* Since constructors cannot be safely captured via Object.assign, this module
|
|
63
|
-
* provides a factory function that uses Reflect.construct internally.
|
|
64
|
-
*
|
|
65
|
-
* These references are captured at module initialization time to protect against
|
|
66
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
67
|
-
*
|
|
68
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/set
|
|
69
|
-
*/
|
|
70
|
-
const _Set = globalThis.Set;
|
|
71
|
-
const _Reflect$1 = globalThis.Reflect;
|
|
72
|
-
/**
|
|
73
|
-
* (Safe copy) Creates a new Set using the captured Set constructor.
|
|
74
|
-
* Use this instead of `new Set()`.
|
|
75
|
-
*
|
|
76
|
-
* @param iterable - Optional iterable of values.
|
|
77
|
-
* @returns A new Set instance.
|
|
78
|
-
*/
|
|
79
|
-
const createSet = (iterable) => _Reflect$1.construct(_Set, iterable ? [iterable] : []);
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Global registry of all caches for bulk operations.
|
|
83
|
-
*/
|
|
84
|
-
const cacheRegistry = createSet();
|
|
85
|
-
/**
|
|
86
|
-
* Create a cache with optional TTL and size limits.
|
|
87
|
-
*
|
|
88
|
-
* The cache provides a simple key-value store with:
|
|
89
|
-
* - Optional TTL (time-to-live) for automatic expiration
|
|
90
|
-
* - Optional maxSize for limiting cache size with FIFO eviction
|
|
91
|
-
* - Lazy expiration (entries are checked on access)
|
|
92
|
-
*
|
|
93
|
-
* @param options - Cache configuration options
|
|
94
|
-
* @returns Cache instance
|
|
95
|
-
*
|
|
96
|
-
* @example
|
|
97
|
-
* ```typescript
|
|
98
|
-
* // Basic cache
|
|
99
|
-
* const cache = createCache<string, number>()
|
|
100
|
-
* cache.set('answer', 42)
|
|
101
|
-
* cache.get('answer') // 42
|
|
102
|
-
*
|
|
103
|
-
* // Cache with TTL (expires after 60 seconds)
|
|
104
|
-
* const ttlCache = createCache<string, object>({ ttl: 60000 })
|
|
105
|
-
*
|
|
106
|
-
* // Cache with max size (evicts oldest when full)
|
|
107
|
-
* const lruCache = createCache<string, object>({ maxSize: 100 })
|
|
108
|
-
*
|
|
109
|
-
* // Combined options
|
|
110
|
-
* const configCache = createCache<string, object>({
|
|
111
|
-
* ttl: 30000,
|
|
112
|
-
* maxSize: 50
|
|
113
|
-
* })
|
|
114
|
-
* ```
|
|
115
|
-
*/
|
|
116
|
-
function createCache(options) {
|
|
117
|
-
const { ttl, maxSize } = options ?? {};
|
|
118
|
-
const store = createMap();
|
|
119
|
-
const insertionOrder = [];
|
|
120
|
-
/**
|
|
121
|
-
* Check if an entry is expired.
|
|
122
|
-
*
|
|
123
|
-
* @param entry - Cache entry to check
|
|
124
|
-
* @returns True if entry is expired
|
|
125
|
-
*/
|
|
126
|
-
function isExpired(entry) {
|
|
127
|
-
if (ttl === undefined)
|
|
128
|
-
return false;
|
|
129
|
-
// eslint-disable-next-line workspace/no-unsafe-builtin-methods -- Date.now() is needed for Jest fake timers compatibility
|
|
130
|
-
return Date.now() - entry.timestamp > ttl;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Evict oldest entries to make room for new ones.
|
|
134
|
-
*/
|
|
135
|
-
function evictIfNeeded() {
|
|
136
|
-
if (maxSize === undefined)
|
|
137
|
-
return;
|
|
138
|
-
while (store.size >= maxSize && insertionOrder.length > 0) {
|
|
139
|
-
const oldestKey = insertionOrder.shift();
|
|
140
|
-
if (oldestKey !== undefined) {
|
|
141
|
-
store.delete(oldestKey);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Remove key from insertion order tracking.
|
|
147
|
-
*
|
|
148
|
-
* @param key - Key to remove from order tracking
|
|
149
|
-
*/
|
|
150
|
-
function removeFromOrder(key) {
|
|
151
|
-
const index = insertionOrder.indexOf(key);
|
|
152
|
-
if (index !== -1) {
|
|
153
|
-
insertionOrder.splice(index, 1);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
const cache = {
|
|
157
|
-
get(key) {
|
|
158
|
-
const entry = store.get(key);
|
|
159
|
-
if (!entry)
|
|
160
|
-
return undefined;
|
|
161
|
-
if (isExpired(entry)) {
|
|
162
|
-
store.delete(key);
|
|
163
|
-
removeFromOrder(key);
|
|
164
|
-
return undefined;
|
|
165
|
-
}
|
|
166
|
-
return entry.value;
|
|
167
|
-
},
|
|
168
|
-
set(key, value) {
|
|
169
|
-
if (store.has(key)) {
|
|
170
|
-
removeFromOrder(key);
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
evictIfNeeded();
|
|
174
|
-
}
|
|
175
|
-
// eslint-disable-next-line workspace/no-unsafe-builtin-methods -- Date.now() is needed for Jest fake timers compatibility
|
|
176
|
-
store.set(key, { value, timestamp: Date.now() });
|
|
177
|
-
insertionOrder.push(key);
|
|
178
|
-
},
|
|
179
|
-
has(key) {
|
|
180
|
-
const entry = store.get(key);
|
|
181
|
-
if (!entry)
|
|
182
|
-
return false;
|
|
183
|
-
if (isExpired(entry)) {
|
|
184
|
-
store.delete(key);
|
|
185
|
-
removeFromOrder(key);
|
|
186
|
-
return false;
|
|
187
|
-
}
|
|
188
|
-
return true;
|
|
189
|
-
},
|
|
190
|
-
delete(key) {
|
|
191
|
-
removeFromOrder(key);
|
|
192
|
-
return store.delete(key);
|
|
193
|
-
},
|
|
194
|
-
clear() {
|
|
195
|
-
store.clear();
|
|
196
|
-
insertionOrder.length = 0;
|
|
197
|
-
},
|
|
198
|
-
size() {
|
|
199
|
-
return store.size;
|
|
200
|
-
},
|
|
201
|
-
keys() {
|
|
202
|
-
return [...insertionOrder];
|
|
203
|
-
},
|
|
204
|
-
};
|
|
205
|
-
cacheRegistry.add(cache);
|
|
206
|
-
return freeze(cache);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Safe copies of Error built-ins via factory functions.
|
|
211
|
-
*
|
|
212
|
-
* Since constructors cannot be safely captured via Object.assign, this module
|
|
213
|
-
* provides factory functions that use Reflect.construct internally.
|
|
214
|
-
*
|
|
215
|
-
* These references are captured at module initialization time to protect against
|
|
216
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
217
|
-
*
|
|
218
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/error
|
|
219
|
-
*/
|
|
220
|
-
const _Error = globalThis.Error;
|
|
221
|
-
const _Reflect = globalThis.Reflect;
|
|
222
|
-
/**
|
|
223
|
-
* (Safe copy) Creates a new Error using the captured Error constructor.
|
|
224
|
-
* Use this instead of `new Error()`.
|
|
225
|
-
*
|
|
226
|
-
* @param message - Optional error message.
|
|
227
|
-
* @param options - Optional error options.
|
|
228
|
-
* @returns A new Error instance.
|
|
229
|
-
*/
|
|
230
|
-
const createError = (message, options) => _Reflect.construct(_Error, [message, options]);
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Safe copies of JSON built-in methods.
|
|
234
|
-
*
|
|
235
|
-
* These references are captured at module initialization time to protect against
|
|
236
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
237
|
-
*
|
|
238
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/json
|
|
239
|
-
*/
|
|
240
|
-
const _JSON = globalThis.JSON;
|
|
241
|
-
/**
|
|
242
|
-
* (Safe copy) Converts a JavaScript Object Notation (JSON) string into an object.
|
|
243
|
-
*/
|
|
244
|
-
const parse = _JSON.parse;
|
|
245
|
-
/**
|
|
246
|
-
* (Safe copy) Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
|
|
247
|
-
*/
|
|
248
|
-
const stringify = _JSON.stringify;
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Safe copies of Array built-in static methods.
|
|
252
|
-
*
|
|
253
|
-
* These references are captured at module initialization time to protect against
|
|
254
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
255
|
-
*
|
|
256
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/array
|
|
257
|
-
*/
|
|
258
|
-
const _Array = globalThis.Array;
|
|
259
|
-
/**
|
|
260
|
-
* (Safe copy) Determines whether the passed value is an Array.
|
|
261
|
-
*/
|
|
262
|
-
const isArray = _Array.isArray;
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Safe copies of Console built-in methods.
|
|
266
|
-
*
|
|
267
|
-
* These references are captured at module initialization time to protect against
|
|
268
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
269
|
-
*
|
|
270
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/console
|
|
271
|
-
*/
|
|
272
|
-
const _console = globalThis.console;
|
|
273
|
-
/**
|
|
274
|
-
* (Safe copy) Outputs a message to the console.
|
|
275
|
-
*/
|
|
276
|
-
const log = _console.log.bind(_console);
|
|
277
|
-
/**
|
|
278
|
-
* (Safe copy) Outputs a warning message to the console.
|
|
279
|
-
*/
|
|
280
|
-
const warn = _console.warn.bind(_console);
|
|
281
|
-
/**
|
|
282
|
-
* (Safe copy) Outputs an error message to the console.
|
|
283
|
-
*/
|
|
284
|
-
const error = _console.error.bind(_console);
|
|
285
|
-
/**
|
|
286
|
-
* (Safe copy) Outputs an informational message to the console.
|
|
287
|
-
*/
|
|
288
|
-
const info = _console.info.bind(_console);
|
|
289
|
-
/**
|
|
290
|
-
* (Safe copy) Outputs a debug message to the console.
|
|
291
|
-
*/
|
|
292
|
-
const debug = _console.debug.bind(_console);
|
|
293
|
-
/**
|
|
294
|
-
* (Safe copy) Outputs a stack trace to the console.
|
|
295
|
-
*/
|
|
296
|
-
_console.trace.bind(_console);
|
|
297
|
-
/**
|
|
298
|
-
* (Safe copy) Displays an interactive listing of the properties of a specified object.
|
|
299
|
-
*/
|
|
300
|
-
_console.dir.bind(_console);
|
|
301
|
-
/**
|
|
302
|
-
* (Safe copy) Displays tabular data as a table.
|
|
303
|
-
*/
|
|
304
|
-
_console.table.bind(_console);
|
|
305
|
-
/**
|
|
306
|
-
* (Safe copy) Writes an error message to the console if the assertion is false.
|
|
307
|
-
*/
|
|
308
|
-
_console.assert.bind(_console);
|
|
309
|
-
/**
|
|
310
|
-
* (Safe copy) Clears the console.
|
|
311
|
-
*/
|
|
312
|
-
_console.clear.bind(_console);
|
|
313
|
-
/**
|
|
314
|
-
* (Safe copy) Logs the number of times that this particular call to count() has been called.
|
|
315
|
-
*/
|
|
316
|
-
_console.count.bind(_console);
|
|
317
|
-
/**
|
|
318
|
-
* (Safe copy) Resets the counter used with console.count().
|
|
319
|
-
*/
|
|
320
|
-
_console.countReset.bind(_console);
|
|
321
|
-
/**
|
|
322
|
-
* (Safe copy) Creates a new inline group in the console.
|
|
323
|
-
*/
|
|
324
|
-
_console.group.bind(_console);
|
|
325
|
-
/**
|
|
326
|
-
* (Safe copy) Creates a new inline group in the console that is initially collapsed.
|
|
327
|
-
*/
|
|
328
|
-
_console.groupCollapsed.bind(_console);
|
|
329
|
-
/**
|
|
330
|
-
* (Safe copy) Exits the current inline group.
|
|
331
|
-
*/
|
|
332
|
-
_console.groupEnd.bind(_console);
|
|
333
|
-
/**
|
|
334
|
-
* (Safe copy) Starts a timer with a name specified as an input parameter.
|
|
335
|
-
*/
|
|
336
|
-
_console.time.bind(_console);
|
|
337
|
-
/**
|
|
338
|
-
* (Safe copy) Stops a timer that was previously started.
|
|
339
|
-
*/
|
|
340
|
-
_console.timeEnd.bind(_console);
|
|
341
|
-
/**
|
|
342
|
-
* (Safe copy) Logs the current value of a timer that was previously started.
|
|
343
|
-
*/
|
|
344
|
-
_console.timeLog.bind(_console);
|
|
345
|
-
|
|
346
|
-
const registeredClasses = [];
|
|
347
|
-
|
|
348
|
-
/**
|
|
349
|
-
* Returns the data type of the target.
|
|
350
|
-
* Uses native `typeof` operator, however, makes distinction between `null`, `array`, and `object`.
|
|
351
|
-
* Also, when classes are registered via `registerClass`, it checks if objects are instance of any known registered class.
|
|
352
|
-
*
|
|
353
|
-
* @param target - The target to get the data type of.
|
|
354
|
-
* @returns The data type of the target.
|
|
355
|
-
*/
|
|
356
|
-
const getType = (target) => {
|
|
357
|
-
if (target === null)
|
|
358
|
-
return 'null';
|
|
359
|
-
const nativeDataType = typeof target;
|
|
360
|
-
if (nativeDataType === 'object') {
|
|
361
|
-
if (isArray(target))
|
|
362
|
-
return 'array';
|
|
363
|
-
for (const registeredClass of registeredClasses) {
|
|
364
|
-
if (target instanceof registeredClass)
|
|
365
|
-
return registeredClass.name;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
return nativeDataType;
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
372
|
-
/**
|
|
373
|
-
* Creates a wrapper function that only executes the wrapped function if the condition function returns true.
|
|
374
|
-
*
|
|
375
|
-
* @param func - The function to be conditionally executed.
|
|
376
|
-
* @param conditionFunc - A function that returns a boolean, determining if `func` should be executed.
|
|
377
|
-
* @returns A wrapped version of `func` that executes conditionally.
|
|
378
|
-
*/
|
|
379
|
-
function createConditionalExecutionFunction(func, conditionFunc) {
|
|
380
|
-
return function (...args) {
|
|
381
|
-
if (conditionFunc()) {
|
|
382
|
-
return func(...args);
|
|
383
|
-
}
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
388
|
-
/**
|
|
389
|
-
* Creates a wrapper function that silently ignores any errors thrown by the wrapped void function.
|
|
390
|
-
* This function is specifically for wrapping functions that do not return a value (void functions).
|
|
391
|
-
* Exceptions are swallowed without any logging or handling.
|
|
392
|
-
*
|
|
393
|
-
* @param func - The void function to be wrapped.
|
|
394
|
-
* @returns A wrapped version of the input function that ignores errors.
|
|
395
|
-
*/
|
|
396
|
-
function createErrorIgnoringFunction(func) {
|
|
397
|
-
return function (...args) {
|
|
398
|
-
try {
|
|
399
|
-
func(...args);
|
|
400
|
-
}
|
|
401
|
-
catch {
|
|
402
|
-
// Deliberately swallowing/ignoring the exception
|
|
403
|
-
}
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
408
|
-
/**
|
|
409
|
-
* A no-operation function (noop) that does nothing regardless of the arguments passed.
|
|
410
|
-
* It is designed to be as permissive as possible in its typing without using the `Function` keyword.
|
|
411
|
-
*
|
|
412
|
-
* @param args - Any arguments passed to the function (ignored)
|
|
413
|
-
*/
|
|
414
|
-
const noop = (...args) => {
|
|
415
|
-
// Intentionally does nothing
|
|
416
|
-
};
|
|
417
|
-
|
|
418
|
-
const logLevels = ['none', 'error', 'warn', 'log', 'info', 'debug'];
|
|
419
|
-
const priority = {
|
|
420
|
-
error: 4,
|
|
421
|
-
warn: 3,
|
|
422
|
-
log: 2,
|
|
423
|
-
info: 1,
|
|
424
|
-
debug: 0,
|
|
425
|
-
};
|
|
426
|
-
/**
|
|
427
|
-
* Validates whether a given string is a valid log level.
|
|
428
|
-
*
|
|
429
|
-
* @param level - The log level to validate
|
|
430
|
-
* @returns True if the level is valid, false otherwise
|
|
431
|
-
*/
|
|
432
|
-
function isValidLogLevel(level) {
|
|
433
|
-
return logLevels.includes(level);
|
|
434
|
-
}
|
|
435
|
-
/**
|
|
436
|
-
* Creates a log level configuration manager for controlling logging behavior.
|
|
437
|
-
* Provides methods to get, set, and evaluate log levels based on priority.
|
|
438
|
-
*
|
|
439
|
-
* @param level - The initial log level (defaults to 'error')
|
|
440
|
-
* @returns A configuration object with log level management methods
|
|
441
|
-
* @throws {Error} When the provided level is not a valid log level
|
|
442
|
-
*/
|
|
443
|
-
function createLogLevelConfig(level = 'error') {
|
|
444
|
-
if (!isValidLogLevel(level)) {
|
|
445
|
-
throw createError('Cannot create log level configuration with a valid default log level');
|
|
446
|
-
}
|
|
447
|
-
const state = { level };
|
|
448
|
-
const getLogLevel = () => state.level;
|
|
449
|
-
const setLogLevel = (level) => {
|
|
450
|
-
if (!isValidLogLevel(level)) {
|
|
451
|
-
throw createError(`Cannot set value '${level}' level. Expected levels are ${logLevels}.`);
|
|
452
|
-
}
|
|
453
|
-
state.level = level;
|
|
454
|
-
};
|
|
455
|
-
const shouldLog = (level) => {
|
|
456
|
-
if (state.level === 'none' || level === 'none' || !isValidLogLevel(level)) {
|
|
457
|
-
return false;
|
|
458
|
-
}
|
|
459
|
-
return priority[level] >= priority[state.level];
|
|
460
|
-
};
|
|
461
|
-
return freeze({
|
|
462
|
-
getLogLevel,
|
|
463
|
-
setLogLevel,
|
|
464
|
-
shouldLog,
|
|
465
|
-
});
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
/**
|
|
469
|
-
* Creates a logger instance with configurable log level filtering.
|
|
470
|
-
* Each log function is wrapped to respect the current log level setting.
|
|
471
|
-
*
|
|
472
|
-
* @param error - Function to handle error-level logs (required)
|
|
473
|
-
* @param warn - Function to handle warning-level logs (optional, defaults to noop)
|
|
474
|
-
* @param log - Function to handle standard logs (optional, defaults to noop)
|
|
475
|
-
* @param info - Function to handle info-level logs (optional, defaults to noop)
|
|
476
|
-
* @param debug - Function to handle debug-level logs (optional, defaults to noop)
|
|
477
|
-
* @returns A frozen logger object with log methods and level control
|
|
478
|
-
* @throws {ErrorLevelFn} When any provided log function is invalid
|
|
479
|
-
*/
|
|
480
|
-
function createLogger(error, warn = noop, log = noop, info = noop, debug = noop) {
|
|
481
|
-
if (notValidLogFn(error)) {
|
|
482
|
-
throw createError(notFnMsg('error'));
|
|
483
|
-
}
|
|
484
|
-
if (notValidLogFn(warn)) {
|
|
485
|
-
throw createError(notFnMsg('warn'));
|
|
486
|
-
}
|
|
487
|
-
if (notValidLogFn(log)) {
|
|
488
|
-
throw createError(notFnMsg('log'));
|
|
489
|
-
}
|
|
490
|
-
if (notValidLogFn(info)) {
|
|
491
|
-
throw createError(notFnMsg('info'));
|
|
492
|
-
}
|
|
493
|
-
if (notValidLogFn(debug)) {
|
|
494
|
-
throw createError(notFnMsg('debug'));
|
|
495
|
-
}
|
|
496
|
-
const { setLogLevel, getLogLevel, shouldLog } = createLogLevelConfig();
|
|
497
|
-
const wrapLogFn = (fn, level) => {
|
|
498
|
-
if (fn === noop)
|
|
499
|
-
return fn;
|
|
500
|
-
const condition = () => shouldLog(level);
|
|
501
|
-
return createConditionalExecutionFunction(createErrorIgnoringFunction(fn), condition);
|
|
502
|
-
};
|
|
503
|
-
return freeze({
|
|
504
|
-
error: wrapLogFn(error, 'error'),
|
|
505
|
-
warn: wrapLogFn(warn, 'warn'),
|
|
506
|
-
log: wrapLogFn(log, 'log'),
|
|
507
|
-
info: wrapLogFn(info, 'info'),
|
|
508
|
-
debug: wrapLogFn(debug, 'debug'),
|
|
509
|
-
setLogLevel,
|
|
510
|
-
getLogLevel,
|
|
511
|
-
});
|
|
512
|
-
}
|
|
513
|
-
/**
|
|
514
|
-
* Validates whether a given value is a valid log function.
|
|
515
|
-
*
|
|
516
|
-
* @param fn - The value to validate
|
|
517
|
-
* @returns True if the value is not a function (invalid), false if it is valid
|
|
518
|
-
*/
|
|
519
|
-
function notValidLogFn(fn) {
|
|
520
|
-
return getType(fn) !== 'function' && fn !== noop;
|
|
521
|
-
}
|
|
522
|
-
/**
|
|
523
|
-
* Generates an error message for invalid log function parameters.
|
|
524
|
-
*
|
|
525
|
-
* @param label - The name of the log function that failed validation
|
|
526
|
-
* @returns A formatted error message string
|
|
527
|
-
*/
|
|
528
|
-
function notFnMsg(label) {
|
|
529
|
-
return `Cannot create a logger when ${label} is not a function`;
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
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 { isSafePath } = require('../../_shared/core/fs/guard/index.cjs.js');
|
|
14
|
+
const { isDirectory, exists } = require('../../_shared/core/fs/stat/index.cjs.js');
|
|
15
|
+
const { createCache } = require('../../_shared/core/cache/index.cjs.js');
|
|
16
|
+
const { matchGlobPattern } = require('../../_shared/core/patterns/glob/index.cjs.js');
|
|
533
17
|
|
|
534
18
|
/**
|
|
535
19
|
* Global log level registry.
|
|
536
20
|
* Tracks all created scoped loggers to allow global log level changes.
|
|
537
21
|
*/
|
|
538
|
-
const loggerRegistry = createSet();
|
|
22
|
+
const loggerRegistry = index_cjs_js.createSet();
|
|
539
23
|
/** Redacted placeholder for sensitive values */
|
|
540
24
|
const REDACTED = '[REDACTED]';
|
|
541
25
|
/**
|
|
@@ -569,17 +53,24 @@ function isSensitiveKey(key) {
|
|
|
569
53
|
*
|
|
570
54
|
* @param obj - Object to sanitize
|
|
571
55
|
* @returns New object with sensitive values redacted
|
|
56
|
+
*
|
|
57
|
+
* @example Sanitizing sensitive data
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const config = { apiKey: 'secret123', endpoint: 'https://api.example.com' }
|
|
60
|
+
* const safe = sanitize(config)
|
|
61
|
+
* // => { apiKey: '[REDACTED]', endpoint: 'https://api.example.com' }
|
|
62
|
+
* ```
|
|
572
63
|
*/
|
|
573
64
|
function sanitize(obj) {
|
|
574
65
|
if (obj === null || obj === undefined) {
|
|
575
66
|
return obj;
|
|
576
67
|
}
|
|
577
|
-
if (isArray(obj)) {
|
|
68
|
+
if (index_cjs_js$5.isArray(obj)) {
|
|
578
69
|
return obj.map((item) => sanitize(item));
|
|
579
70
|
}
|
|
580
71
|
if (typeof obj === 'object') {
|
|
581
72
|
const result = {};
|
|
582
|
-
for (const [key, value] of entries(obj)) {
|
|
73
|
+
for (const [key, value] of index_cjs_js$2.entries(obj)) {
|
|
583
74
|
if (isSensitiveKey(key)) {
|
|
584
75
|
result[key] = REDACTED;
|
|
585
76
|
}
|
|
@@ -604,9 +95,9 @@ function sanitize(obj) {
|
|
|
604
95
|
*/
|
|
605
96
|
function formatMessage(namespace, message, meta) {
|
|
606
97
|
const prefix = `[${namespace}]`;
|
|
607
|
-
if (meta && keys(meta).length > 0) {
|
|
98
|
+
if (meta && index_cjs_js$2.keys(meta).length > 0) {
|
|
608
99
|
const sanitizedMeta = sanitize(meta);
|
|
609
|
-
return `${prefix} ${message} ${stringify(sanitizedMeta)}`;
|
|
100
|
+
return `${prefix} ${message} ${index_cjs_js$6.stringify(sanitizedMeta)}`;
|
|
610
101
|
}
|
|
611
102
|
return `${prefix} ${message}`;
|
|
612
103
|
}
|
|
@@ -619,7 +110,7 @@ function formatMessage(namespace, message, meta) {
|
|
|
619
110
|
* @param options - Logger configuration options
|
|
620
111
|
* @returns A configured scoped logger instance
|
|
621
112
|
*
|
|
622
|
-
* @example
|
|
113
|
+
* @example Creating a scoped logger
|
|
623
114
|
* ```typescript
|
|
624
115
|
* const logger = createScopedLogger('project-scope')
|
|
625
116
|
* logger.setLogLevel('debug')
|
|
@@ -638,9 +129,9 @@ function createScopedLogger(namespace, options = {}) {
|
|
|
638
129
|
const processedMeta = sanitizeSecrets && meta ? sanitize(meta) : meta;
|
|
639
130
|
baseFn(formatMessage(namespace, message, processedMeta));
|
|
640
131
|
};
|
|
641
|
-
const baseLogger = createLogger(createLogFn(error), createLogFn(warn), createLogFn(log), createLogFn(info), createLogFn(debug));
|
|
132
|
+
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));
|
|
642
133
|
baseLogger.setLogLevel(level);
|
|
643
|
-
const scopedLogger = freeze({
|
|
134
|
+
const scopedLogger = index_cjs_js$2.freeze({
|
|
644
135
|
error: (message, meta) => baseLogger.error(message, meta),
|
|
645
136
|
warn: (message, meta) => baseLogger.warn(message, meta),
|
|
646
137
|
log: (message, meta) => baseLogger.log(message, meta),
|
|
@@ -656,7 +147,7 @@ function createScopedLogger(namespace, options = {}) {
|
|
|
656
147
|
* Default logger instance for the project-scope library.
|
|
657
148
|
* Use this for general logging within the library.
|
|
658
149
|
*
|
|
659
|
-
* @example
|
|
150
|
+
* @example Using the default logger
|
|
660
151
|
* ```typescript
|
|
661
152
|
* import { logger } from '@hyperfrontend/project-scope/core'
|
|
662
153
|
*
|
|
@@ -674,10 +165,19 @@ createScopedLogger('project-scope:fs');
|
|
|
674
165
|
* @param code - The category code for this type of filesystem failure
|
|
675
166
|
* @param context - Additional context including path, operation, and cause
|
|
676
167
|
* @returns A configured Error object with code and context properties
|
|
168
|
+
*
|
|
169
|
+
* @example Creating a file system error
|
|
170
|
+
* ```typescript
|
|
171
|
+
* throw createFileSystemError(
|
|
172
|
+
* 'Cannot read file',
|
|
173
|
+
* 'FS_READ_ERROR',
|
|
174
|
+
* { path: './missing.txt', operation: 'read' }
|
|
175
|
+
* )
|
|
176
|
+
* ```
|
|
677
177
|
*/
|
|
678
178
|
function createFileSystemError(message, code, context) {
|
|
679
|
-
const error = createError(message);
|
|
680
|
-
defineProperties(error, {
|
|
179
|
+
const error = index_cjs_js$7.createError(message);
|
|
180
|
+
index_cjs_js$2.defineProperties(error, {
|
|
681
181
|
code: { value: code, enumerable: true },
|
|
682
182
|
context: { value: context, enumerable: true },
|
|
683
183
|
});
|
|
@@ -689,9 +189,17 @@ function createFileSystemError(message, code, context) {
|
|
|
689
189
|
* @param filePath - Path to file
|
|
690
190
|
* @param encoding - File encoding (default: utf-8)
|
|
691
191
|
* @returns File contents or null if file doesn't exist
|
|
192
|
+
*
|
|
193
|
+
* @example Reading file if it exists
|
|
194
|
+
* ```typescript
|
|
195
|
+
* const content = readFileIfExists('./optional-config.json')
|
|
196
|
+
* if (content) {
|
|
197
|
+
* // File existed, use content
|
|
198
|
+
* }
|
|
199
|
+
* ```
|
|
692
200
|
*/
|
|
693
201
|
function readFileIfExists(filePath, encoding = 'utf-8') {
|
|
694
|
-
if (!node_fs.existsSync(filePath)) {
|
|
202
|
+
if (!isSafePath(filePath) || !node_fs.existsSync(filePath)) {
|
|
695
203
|
return null;
|
|
696
204
|
}
|
|
697
205
|
try {
|
|
@@ -702,56 +210,6 @@ function readFileIfExists(filePath, encoding = 'utf-8') {
|
|
|
702
210
|
}
|
|
703
211
|
}
|
|
704
212
|
|
|
705
|
-
createScopedLogger('project-scope:fs:write');
|
|
706
|
-
|
|
707
|
-
/**
|
|
708
|
-
* Get file stats with error handling.
|
|
709
|
-
*
|
|
710
|
-
* @param filePath - Path to file
|
|
711
|
-
* @param followSymlinks - Whether to follow symlinks (default: true)
|
|
712
|
-
* @returns File stats or null if path doesn't exist
|
|
713
|
-
*/
|
|
714
|
-
function getFileStat(filePath, followSymlinks = true) {
|
|
715
|
-
if (!node_fs.existsSync(filePath)) {
|
|
716
|
-
return null;
|
|
717
|
-
}
|
|
718
|
-
try {
|
|
719
|
-
const stat = followSymlinks ? node_fs.statSync(filePath) : node_fs.lstatSync(filePath);
|
|
720
|
-
return {
|
|
721
|
-
isFile: stat.isFile(),
|
|
722
|
-
isDirectory: stat.isDirectory(),
|
|
723
|
-
isSymlink: stat.isSymbolicLink(),
|
|
724
|
-
size: stat.size,
|
|
725
|
-
created: stat.birthtime,
|
|
726
|
-
modified: stat.mtime,
|
|
727
|
-
accessed: stat.atime,
|
|
728
|
-
mode: stat.mode,
|
|
729
|
-
};
|
|
730
|
-
}
|
|
731
|
-
catch {
|
|
732
|
-
return null;
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
/**
|
|
736
|
-
* Check if path is a directory.
|
|
737
|
-
*
|
|
738
|
-
* @param dirPath - Path to check
|
|
739
|
-
* @returns True if path is a directory
|
|
740
|
-
*/
|
|
741
|
-
function isDirectory(dirPath) {
|
|
742
|
-
const stats = getFileStat(dirPath);
|
|
743
|
-
return stats?.isDirectory ?? false;
|
|
744
|
-
}
|
|
745
|
-
/**
|
|
746
|
-
* Check if path exists.
|
|
747
|
-
*
|
|
748
|
-
* @param filePath - Path to check
|
|
749
|
-
* @returns True if path exists
|
|
750
|
-
*/
|
|
751
|
-
function exists(filePath) {
|
|
752
|
-
return node_fs.existsSync(filePath);
|
|
753
|
-
}
|
|
754
|
-
|
|
755
213
|
const fsDirLogger = createScopedLogger('project-scope:fs:dir');
|
|
756
214
|
/**
|
|
757
215
|
* List immediate contents of a directory.
|
|
@@ -760,7 +218,7 @@ const fsDirLogger = createScopedLogger('project-scope:fs:dir');
|
|
|
760
218
|
* @returns Array of entries with metadata for each file/directory
|
|
761
219
|
* @throws {Error} If directory doesn't exist or isn't a directory
|
|
762
220
|
*
|
|
763
|
-
* @example
|
|
221
|
+
* @example Listing directory contents
|
|
764
222
|
* ```typescript
|
|
765
223
|
* import { readDirectory } from '@hyperfrontend/project-scope'
|
|
766
224
|
*
|
|
@@ -803,6 +261,8 @@ function readDirectory(dirPath) {
|
|
|
803
261
|
|
|
804
262
|
createScopedLogger('project-scope:fs:traversal');
|
|
805
263
|
|
|
264
|
+
createScopedLogger('project-scope:fs:write');
|
|
265
|
+
|
|
806
266
|
const packageLogger = createScopedLogger('project-scope:project:package');
|
|
807
267
|
/**
|
|
808
268
|
* Verifies that a value is an object with only string values,
|
|
@@ -814,7 +274,7 @@ const packageLogger = createScopedLogger('project-scope:project:package');
|
|
|
814
274
|
function isStringRecord(value) {
|
|
815
275
|
if (typeof value !== 'object' || value === null)
|
|
816
276
|
return false;
|
|
817
|
-
return values(value).every((v) => typeof v === 'string');
|
|
277
|
+
return index_cjs_js$2.values(value).every((v) => typeof v === 'string');
|
|
818
278
|
}
|
|
819
279
|
/**
|
|
820
280
|
* Extracts and normalizes the workspaces field from package.json,
|
|
@@ -824,12 +284,12 @@ function isStringRecord(value) {
|
|
|
824
284
|
* @returns Normalized workspace patterns or undefined if invalid
|
|
825
285
|
*/
|
|
826
286
|
function parseWorkspaces(value) {
|
|
827
|
-
if (isArray(value) && value.every((v) => typeof v === 'string')) {
|
|
287
|
+
if (index_cjs_js$5.isArray(value) && value.every((v) => typeof v === 'string')) {
|
|
828
288
|
return value;
|
|
829
289
|
}
|
|
830
290
|
if (typeof value === 'object' && value !== null) {
|
|
831
291
|
const obj = value;
|
|
832
|
-
if (isArray(obj['packages'])) {
|
|
292
|
+
if (index_cjs_js$5.isArray(obj['packages'])) {
|
|
833
293
|
return { packages: obj['packages'] };
|
|
834
294
|
}
|
|
835
295
|
}
|
|
@@ -843,7 +303,7 @@ function parseWorkspaces(value) {
|
|
|
843
303
|
*/
|
|
844
304
|
function validatePackageJson(data) {
|
|
845
305
|
if (typeof data !== 'object' || data === null) {
|
|
846
|
-
throw createError('package.json must be an object');
|
|
306
|
+
throw index_cjs_js$7.createError('package.json must be an object');
|
|
847
307
|
}
|
|
848
308
|
const pkg = data;
|
|
849
309
|
return {
|
|
@@ -872,6 +332,16 @@ function validatePackageJson(data) {
|
|
|
872
332
|
*
|
|
873
333
|
* @param projectPath - Project directory path or path to package.json
|
|
874
334
|
* @returns Parsed package.json or null if not found
|
|
335
|
+
*
|
|
336
|
+
* @example Reading package.json if it exists
|
|
337
|
+
* ```typescript
|
|
338
|
+
* import { readPackageJsonIfExists } from '@hyperfrontend/project-scope'
|
|
339
|
+
*
|
|
340
|
+
* const pkg = readPackageJsonIfExists('/path/to/project')
|
|
341
|
+
* if (pkg) {
|
|
342
|
+
* console.log('Found:', pkg.name)
|
|
343
|
+
* }
|
|
344
|
+
* ```
|
|
875
345
|
*/
|
|
876
346
|
function readPackageJsonIfExists(projectPath) {
|
|
877
347
|
const packageJsonPath = projectPath.endsWith('package.json') ? projectPath : node_path.join(projectPath, 'package.json');
|
|
@@ -881,7 +351,7 @@ function readPackageJsonIfExists(projectPath) {
|
|
|
881
351
|
return null;
|
|
882
352
|
}
|
|
883
353
|
try {
|
|
884
|
-
const validated = validatePackageJson(parse(content));
|
|
354
|
+
const validated = validatePackageJson(index_cjs_js$6.parse(content));
|
|
885
355
|
packageLogger.debug('Package.json loaded', { path: packageJsonPath, name: validated.name });
|
|
886
356
|
return validated;
|
|
887
357
|
}
|
|
@@ -891,198 +361,6 @@ function readPackageJsonIfExists(projectPath) {
|
|
|
891
361
|
}
|
|
892
362
|
}
|
|
893
363
|
|
|
894
|
-
/**
|
|
895
|
-
* Match path against glob pattern using safe character iteration.
|
|
896
|
-
* Avoids regex to prevent ReDoS attacks.
|
|
897
|
-
*
|
|
898
|
-
* Supported patterns:
|
|
899
|
-
* - * matches any characters except /
|
|
900
|
-
* - ** matches any characters including /
|
|
901
|
-
* - ? matches exactly one character except /
|
|
902
|
-
* - {a,b,c} matches any of the alternatives
|
|
903
|
-
*
|
|
904
|
-
* @param path - The filesystem path to test against the pattern
|
|
905
|
-
* @param pattern - The glob pattern to match against
|
|
906
|
-
* @returns True if path matches pattern
|
|
907
|
-
*
|
|
908
|
-
* @example
|
|
909
|
-
* ```typescript
|
|
910
|
-
* import { matchGlobPattern } from '@hyperfrontend/project-scope'
|
|
911
|
-
*
|
|
912
|
-
* matchGlobPattern('src/utils/helper.ts', '\*\*\/*.ts') // true
|
|
913
|
-
* matchGlobPattern('test.spec.ts', '\*.spec.ts') // true
|
|
914
|
-
* matchGlobPattern('config.json', '\*.{json,yaml}') // true
|
|
915
|
-
* matchGlobPattern('src/index.ts', 'src/\*.ts') // true
|
|
916
|
-
* ```
|
|
917
|
-
*/
|
|
918
|
-
function matchGlobPattern(path, pattern) {
|
|
919
|
-
return matchSegments(path.split('/'), pattern.split('/'), 0, 0);
|
|
920
|
-
}
|
|
921
|
-
/**
|
|
922
|
-
* Internal recursive function to match path segments against pattern segments.
|
|
923
|
-
*
|
|
924
|
-
* @param pathParts - Array of path segments split by '/'
|
|
925
|
-
* @param patternParts - Array of pattern segments split by '/'
|
|
926
|
-
* @param pathIdx - Current index in pathParts being examined
|
|
927
|
-
* @param patternIdx - Current index in patternParts being examined
|
|
928
|
-
* @returns True if remaining segments match
|
|
929
|
-
*/
|
|
930
|
-
function matchSegments(pathParts, patternParts, pathIdx, patternIdx) {
|
|
931
|
-
if (pathIdx === pathParts.length && patternIdx === patternParts.length) {
|
|
932
|
-
return true;
|
|
933
|
-
}
|
|
934
|
-
if (patternIdx >= patternParts.length) {
|
|
935
|
-
return false;
|
|
936
|
-
}
|
|
937
|
-
const patternPart = patternParts[patternIdx];
|
|
938
|
-
if (patternPart === '**') {
|
|
939
|
-
for (let i = pathIdx; i <= pathParts.length; i++) {
|
|
940
|
-
if (matchSegments(pathParts, patternParts, i, patternIdx + 1)) {
|
|
941
|
-
return true;
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
return false;
|
|
945
|
-
}
|
|
946
|
-
if (pathIdx >= pathParts.length) {
|
|
947
|
-
return false;
|
|
948
|
-
}
|
|
949
|
-
const pathPart = pathParts[pathIdx];
|
|
950
|
-
if (matchSegment(pathPart, patternPart)) {
|
|
951
|
-
return matchSegments(pathParts, patternParts, pathIdx + 1, patternIdx + 1);
|
|
952
|
-
}
|
|
953
|
-
return false;
|
|
954
|
-
}
|
|
955
|
-
/**
|
|
956
|
-
* Match a single path segment against a pattern segment.
|
|
957
|
-
* Handles *, ?, and {a,b,c} patterns.
|
|
958
|
-
*
|
|
959
|
-
* @param text - The path segment text to match
|
|
960
|
-
* @param pattern - The pattern segment to match against
|
|
961
|
-
* @returns True if the text matches the pattern
|
|
962
|
-
*/
|
|
963
|
-
function matchSegment(text, pattern) {
|
|
964
|
-
let textIdx = 0;
|
|
965
|
-
let patternIdx = 0;
|
|
966
|
-
while (patternIdx < pattern.length) {
|
|
967
|
-
const char = pattern[patternIdx];
|
|
968
|
-
if (char === '*') {
|
|
969
|
-
patternIdx++;
|
|
970
|
-
if (patternIdx === pattern.length) {
|
|
971
|
-
return true;
|
|
972
|
-
}
|
|
973
|
-
for (let i = textIdx; i <= text.length; i++) {
|
|
974
|
-
if (matchSegmentFrom(text, i, pattern, patternIdx)) {
|
|
975
|
-
return true;
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
return false;
|
|
979
|
-
}
|
|
980
|
-
else if (char === '?') {
|
|
981
|
-
if (textIdx >= text.length) {
|
|
982
|
-
return false;
|
|
983
|
-
}
|
|
984
|
-
textIdx++;
|
|
985
|
-
patternIdx++;
|
|
986
|
-
}
|
|
987
|
-
else if (char === '{') {
|
|
988
|
-
const closeIdx = findClosingBrace(pattern, patternIdx);
|
|
989
|
-
if (closeIdx === -1) {
|
|
990
|
-
if (textIdx >= text.length || text[textIdx] !== char) {
|
|
991
|
-
return false;
|
|
992
|
-
}
|
|
993
|
-
textIdx++;
|
|
994
|
-
patternIdx++;
|
|
995
|
-
}
|
|
996
|
-
else {
|
|
997
|
-
const alternatives = extractAlternatives(pattern.slice(patternIdx + 1, closeIdx));
|
|
998
|
-
for (const alt of alternatives) {
|
|
999
|
-
if (matchSegmentFrom(text, textIdx, text.slice(0, textIdx) + alt + pattern.slice(closeIdx + 1), textIdx)) {
|
|
1000
|
-
return true;
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
return false;
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
else {
|
|
1007
|
-
if (textIdx >= text.length || text[textIdx] !== char) {
|
|
1008
|
-
return false;
|
|
1009
|
-
}
|
|
1010
|
-
textIdx++;
|
|
1011
|
-
patternIdx++;
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
return textIdx === text.length;
|
|
1015
|
-
}
|
|
1016
|
-
/**
|
|
1017
|
-
* Helper to match from a specific position.
|
|
1018
|
-
*
|
|
1019
|
-
* @param text - The full text being matched
|
|
1020
|
-
* @param textIdx - The starting index in text to match from
|
|
1021
|
-
* @param pattern - The full pattern being matched
|
|
1022
|
-
* @param patternIdx - The starting index in pattern to match from
|
|
1023
|
-
* @returns True if the text matches the pattern from the given positions
|
|
1024
|
-
*/
|
|
1025
|
-
function matchSegmentFrom(text, textIdx, pattern, patternIdx) {
|
|
1026
|
-
const remainingText = text.slice(textIdx);
|
|
1027
|
-
const remainingPattern = pattern.slice(patternIdx);
|
|
1028
|
-
return matchSegment(remainingText, remainingPattern);
|
|
1029
|
-
}
|
|
1030
|
-
/**
|
|
1031
|
-
* Find closing brace for {a,b,c} pattern.
|
|
1032
|
-
*
|
|
1033
|
-
* @param pattern - The pattern string to search within
|
|
1034
|
-
* @param startIdx - The index of the opening brace
|
|
1035
|
-
* @returns The index of the matching closing brace, or -1 if not found
|
|
1036
|
-
*/
|
|
1037
|
-
function findClosingBrace(pattern, startIdx) {
|
|
1038
|
-
let depth = 0;
|
|
1039
|
-
for (let i = startIdx; i < pattern.length; i++) {
|
|
1040
|
-
if (pattern[i] === '{') {
|
|
1041
|
-
depth++;
|
|
1042
|
-
}
|
|
1043
|
-
else if (pattern[i] === '}') {
|
|
1044
|
-
depth--;
|
|
1045
|
-
if (depth === 0) {
|
|
1046
|
-
return i;
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
return -1;
|
|
1051
|
-
}
|
|
1052
|
-
/**
|
|
1053
|
-
* Extract alternatives from {a,b,c} pattern content.
|
|
1054
|
-
*
|
|
1055
|
-
* @param content - The content between braces (without the braces themselves)
|
|
1056
|
-
* @returns Array of alternative strings split by commas at depth 0
|
|
1057
|
-
*/
|
|
1058
|
-
function extractAlternatives(content) {
|
|
1059
|
-
const alternatives = [];
|
|
1060
|
-
let current = '';
|
|
1061
|
-
let depth = 0;
|
|
1062
|
-
for (let i = 0; i < content.length; i++) {
|
|
1063
|
-
const char = content[i];
|
|
1064
|
-
if (char === '{') {
|
|
1065
|
-
depth++;
|
|
1066
|
-
current += char;
|
|
1067
|
-
}
|
|
1068
|
-
else if (char === '}') {
|
|
1069
|
-
depth--;
|
|
1070
|
-
current += char;
|
|
1071
|
-
}
|
|
1072
|
-
else if (char === ',' && depth === 0) {
|
|
1073
|
-
alternatives.push(current);
|
|
1074
|
-
current = '';
|
|
1075
|
-
}
|
|
1076
|
-
else {
|
|
1077
|
-
current += char;
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
if (current) {
|
|
1081
|
-
alternatives.push(current);
|
|
1082
|
-
}
|
|
1083
|
-
return alternatives;
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
364
|
const walkLogger = createScopedLogger('project-scope:project:walk');
|
|
1087
365
|
/**
|
|
1088
366
|
* Reads .gitignore file from the given directory and extracts
|
|
@@ -1148,6 +426,18 @@ function matchPattern(path, pattern) {
|
|
|
1148
426
|
* @param startPath - Root directory to begin traversal
|
|
1149
427
|
* @param visitor - Callback function invoked for each file system entry
|
|
1150
428
|
* @param options - Configuration for traversal behavior
|
|
429
|
+
*
|
|
430
|
+
* @example Walking a directory tree
|
|
431
|
+
* ```typescript
|
|
432
|
+
* import { walkDirectory } from '@hyperfrontend/project-scope'
|
|
433
|
+
*
|
|
434
|
+
* const tsFiles: string[] = []
|
|
435
|
+
* walkDirectory('./src', (entry) => {
|
|
436
|
+
* if (entry.isFile && entry.name.endsWith('.ts')) {
|
|
437
|
+
* tsFiles.push(entry.relativePath)
|
|
438
|
+
* }
|
|
439
|
+
* }, { maxDepth: 5, respectGitignore: true })
|
|
440
|
+
* ```
|
|
1151
441
|
*/
|
|
1152
442
|
function walkDirectory(startPath, visitor, options) {
|
|
1153
443
|
walkLogger.debug('Starting directory walk', {
|
|
@@ -1244,7 +534,7 @@ function matchesPatterns(path, patterns) {
|
|
|
1244
534
|
* @param options - Configuration for search behavior
|
|
1245
535
|
* @returns List of relative file paths that match the patterns
|
|
1246
536
|
*
|
|
1247
|
-
* @example
|
|
537
|
+
* @example Finding files by pattern
|
|
1248
538
|
* ```typescript
|
|
1249
539
|
* import { findFiles } from '@hyperfrontend/project-scope'
|
|
1250
540
|
*
|
|
@@ -1262,7 +552,7 @@ function matchesPatterns(path, patterns) {
|
|
|
1262
552
|
* ```
|
|
1263
553
|
*/
|
|
1264
554
|
function findFiles(startPath, patterns, options) {
|
|
1265
|
-
const normalizedPatterns = isArray(patterns) ? patterns : [patterns];
|
|
555
|
+
const normalizedPatterns = index_cjs_js$5.isArray(patterns) ? patterns : [patterns];
|
|
1266
556
|
searchLogger.debug('Finding files', { startPath, patterns: normalizedPatterns, maxResults: options?.maxResults });
|
|
1267
557
|
const results = [];
|
|
1268
558
|
const maxResults = options?.maxResults ?? Infinity;
|
|
@@ -1331,7 +621,7 @@ const CONVENTION_ENTRIES = [
|
|
|
1331
621
|
* @param entryPoints - Array to add entry points to
|
|
1332
622
|
*/
|
|
1333
623
|
function discoverFromExports(exports$1, entryPoints) {
|
|
1334
|
-
for (const [key, value] of entries(exports$1)) {
|
|
624
|
+
for (const [key, value] of index_cjs_js$2.entries(exports$1)) {
|
|
1335
625
|
if (typeof value === 'string') {
|
|
1336
626
|
if (!entryPoints.some((e) => e.path === value)) {
|
|
1337
627
|
entryPoints.push({
|
|
@@ -1372,7 +662,7 @@ function discoverFromExports(exports$1, entryPoints) {
|
|
|
1372
662
|
* @param options - Discovery options
|
|
1373
663
|
* @returns Array of discovered entry points sorted by confidence
|
|
1374
664
|
*
|
|
1375
|
-
* @example
|
|
665
|
+
* @example Discovering project entry points
|
|
1376
666
|
* ```typescript
|
|
1377
667
|
* import { discoverEntryPoints } from '@hyperfrontend/project-scope'
|
|
1378
668
|
*
|
|
@@ -1431,7 +721,7 @@ function discoverEntryPoints(projectPath, options) {
|
|
|
1431
721
|
}
|
|
1432
722
|
if (packageJson.bin) {
|
|
1433
723
|
const bins = typeof packageJson.bin === 'string' ? { [packageJson.name ?? 'cli']: packageJson.bin } : packageJson.bin;
|
|
1434
|
-
for (const [name, path] of entries(bins)) {
|
|
724
|
+
for (const [name, path] of index_cjs_js$2.entries(bins)) {
|
|
1435
725
|
if (typeof path === 'string' && !extendedEntryPoints.some((e) => e.path === path)) {
|
|
1436
726
|
extendedEntryPoints.push({
|
|
1437
727
|
path,
|
|
@@ -1542,6 +832,14 @@ function discoverEntryPoints(projectPath, options) {
|
|
|
1542
832
|
* Clear the entry point discovery cache.
|
|
1543
833
|
*
|
|
1544
834
|
* Useful for testing or when the project files have changed.
|
|
835
|
+
*
|
|
836
|
+
* @example Clearing the entry point cache
|
|
837
|
+
* ```typescript
|
|
838
|
+
* import { clearEntryPointCache } from '@hyperfrontend/project-scope'
|
|
839
|
+
*
|
|
840
|
+
* // Reset cache before re-analyzing after file changes
|
|
841
|
+
* clearEntryPointCache()
|
|
842
|
+
* ```
|
|
1545
843
|
*/
|
|
1546
844
|
function clearEntryPointCache() {
|
|
1547
845
|
entryPointCache.clear();
|
|
@@ -1550,4 +848,3 @@ function clearEntryPointCache() {
|
|
|
1550
848
|
exports.ENTRY_POINT_PATTERNS = ENTRY_POINT_PATTERNS;
|
|
1551
849
|
exports.clearEntryPointCache = clearEntryPointCache;
|
|
1552
850
|
exports.discoverEntryPoints = discoverEntryPoints;
|
|
1553
|
-
//# sourceMappingURL=index.cjs.js.map
|