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