@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
package/tech/types/index.cjs.js
CHANGED
|
@@ -1,412 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const _JSON = globalThis.JSON;
|
|
16
|
-
/**
|
|
17
|
-
* (Safe copy) Converts a JavaScript Object Notation (JSON) string into an object.
|
|
18
|
-
*/
|
|
19
|
-
const parse = _JSON.parse;
|
|
20
|
-
/**
|
|
21
|
-
* (Safe copy) Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
|
|
22
|
-
*/
|
|
23
|
-
const stringify = _JSON.stringify;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Safe copies of Math built-in methods.
|
|
27
|
-
*
|
|
28
|
-
* These references are captured at module initialization time to protect against
|
|
29
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
30
|
-
*
|
|
31
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/math
|
|
32
|
-
*/
|
|
33
|
-
// Capture references at module initialization time
|
|
34
|
-
const _Math = globalThis.Math;
|
|
35
|
-
/**
|
|
36
|
-
* (Safe copy) Returns the smaller of zero or more numbers.
|
|
37
|
-
*/
|
|
38
|
-
const min = _Math.min;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Safe copies of Object built-in methods.
|
|
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/object
|
|
47
|
-
*/
|
|
48
|
-
// Capture references at module initialization time
|
|
49
|
-
const _Object = globalThis.Object;
|
|
50
|
-
/**
|
|
51
|
-
* (Safe copy) Prevents modification of existing property attributes and values,
|
|
52
|
-
* and prevents the addition of new properties.
|
|
53
|
-
*/
|
|
54
|
-
const freeze = _Object.freeze;
|
|
55
|
-
/**
|
|
56
|
-
* (Safe copy) Returns the names of the enumerable string properties and methods of an object.
|
|
57
|
-
*/
|
|
58
|
-
const keys = _Object.keys;
|
|
59
|
-
/**
|
|
60
|
-
* (Safe copy) Returns an array of key/values of the enumerable own properties of an object.
|
|
61
|
-
*/
|
|
62
|
-
const entries = _Object.entries;
|
|
63
|
-
/**
|
|
64
|
-
* (Safe copy) Returns an array of values of the enumerable own properties of an object.
|
|
65
|
-
*/
|
|
66
|
-
const values = _Object.values;
|
|
67
|
-
/**
|
|
68
|
-
* (Safe copy) Adds one or more properties to an object, and/or modifies attributes of existing properties.
|
|
69
|
-
*/
|
|
70
|
-
const defineProperties = _Object.defineProperties;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Safe copies of Error built-ins via factory functions.
|
|
74
|
-
*
|
|
75
|
-
* Since constructors cannot be safely captured via Object.assign, this module
|
|
76
|
-
* provides factory functions that use Reflect.construct internally.
|
|
77
|
-
*
|
|
78
|
-
* These references are captured at module initialization time to protect against
|
|
79
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
80
|
-
*
|
|
81
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/error
|
|
82
|
-
*/
|
|
83
|
-
// Capture references at module initialization time
|
|
84
|
-
const _Error = globalThis.Error;
|
|
85
|
-
const _Reflect$1 = globalThis.Reflect;
|
|
86
|
-
/**
|
|
87
|
-
* (Safe copy) Creates a new Error using the captured Error constructor.
|
|
88
|
-
* Use this instead of `new Error()`.
|
|
89
|
-
*
|
|
90
|
-
* @param message - Optional error message.
|
|
91
|
-
* @param options - Optional error options.
|
|
92
|
-
* @returns A new Error instance.
|
|
93
|
-
*/
|
|
94
|
-
const createError = (message, options) => _Reflect$1.construct(_Error, [message, options]);
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Safe copies of Array built-in static methods.
|
|
98
|
-
*
|
|
99
|
-
* These references are captured at module initialization time to protect against
|
|
100
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
101
|
-
*
|
|
102
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/array
|
|
103
|
-
*/
|
|
104
|
-
// Capture references at module initialization time
|
|
105
|
-
const _Array = globalThis.Array;
|
|
106
|
-
/**
|
|
107
|
-
* (Safe copy) Determines whether the passed value is an Array.
|
|
108
|
-
*/
|
|
109
|
-
const isArray = _Array.isArray;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Safe copies of Console built-in methods.
|
|
113
|
-
*
|
|
114
|
-
* These references are captured at module initialization time to protect against
|
|
115
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
116
|
-
*
|
|
117
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/console
|
|
118
|
-
*/
|
|
119
|
-
// Capture references at module initialization time
|
|
120
|
-
const _console = globalThis.console;
|
|
121
|
-
/**
|
|
122
|
-
* (Safe copy) Outputs a message to the console.
|
|
123
|
-
*/
|
|
124
|
-
const log = _console.log.bind(_console);
|
|
125
|
-
/**
|
|
126
|
-
* (Safe copy) Outputs a warning message to the console.
|
|
127
|
-
*/
|
|
128
|
-
const warn = _console.warn.bind(_console);
|
|
129
|
-
/**
|
|
130
|
-
* (Safe copy) Outputs an error message to the console.
|
|
131
|
-
*/
|
|
132
|
-
const error = _console.error.bind(_console);
|
|
133
|
-
/**
|
|
134
|
-
* (Safe copy) Outputs an informational message to the console.
|
|
135
|
-
*/
|
|
136
|
-
const info = _console.info.bind(_console);
|
|
137
|
-
/**
|
|
138
|
-
* (Safe copy) Outputs a debug message to the console.
|
|
139
|
-
*/
|
|
140
|
-
const debug = _console.debug.bind(_console);
|
|
141
|
-
/**
|
|
142
|
-
* (Safe copy) Outputs a stack trace to the console.
|
|
143
|
-
*/
|
|
144
|
-
_console.trace.bind(_console);
|
|
145
|
-
/**
|
|
146
|
-
* (Safe copy) Displays an interactive listing of the properties of a specified object.
|
|
147
|
-
*/
|
|
148
|
-
_console.dir.bind(_console);
|
|
149
|
-
/**
|
|
150
|
-
* (Safe copy) Displays tabular data as a table.
|
|
151
|
-
*/
|
|
152
|
-
_console.table.bind(_console);
|
|
153
|
-
/**
|
|
154
|
-
* (Safe copy) Writes an error message to the console if the assertion is false.
|
|
155
|
-
*/
|
|
156
|
-
_console.assert.bind(_console);
|
|
157
|
-
/**
|
|
158
|
-
* (Safe copy) Clears the console.
|
|
159
|
-
*/
|
|
160
|
-
_console.clear.bind(_console);
|
|
161
|
-
/**
|
|
162
|
-
* (Safe copy) Logs the number of times that this particular call to count() has been called.
|
|
163
|
-
*/
|
|
164
|
-
_console.count.bind(_console);
|
|
165
|
-
/**
|
|
166
|
-
* (Safe copy) Resets the counter used with console.count().
|
|
167
|
-
*/
|
|
168
|
-
_console.countReset.bind(_console);
|
|
169
|
-
/**
|
|
170
|
-
* (Safe copy) Creates a new inline group in the console.
|
|
171
|
-
*/
|
|
172
|
-
_console.group.bind(_console);
|
|
173
|
-
/**
|
|
174
|
-
* (Safe copy) Creates a new inline group in the console that is initially collapsed.
|
|
175
|
-
*/
|
|
176
|
-
_console.groupCollapsed.bind(_console);
|
|
177
|
-
/**
|
|
178
|
-
* (Safe copy) Exits the current inline group.
|
|
179
|
-
*/
|
|
180
|
-
_console.groupEnd.bind(_console);
|
|
181
|
-
/**
|
|
182
|
-
* (Safe copy) Starts a timer with a name specified as an input parameter.
|
|
183
|
-
*/
|
|
184
|
-
_console.time.bind(_console);
|
|
185
|
-
/**
|
|
186
|
-
* (Safe copy) Stops a timer that was previously started.
|
|
187
|
-
*/
|
|
188
|
-
_console.timeEnd.bind(_console);
|
|
189
|
-
/**
|
|
190
|
-
* (Safe copy) Logs the current value of a timer that was previously started.
|
|
191
|
-
*/
|
|
192
|
-
_console.timeLog.bind(_console);
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Safe copies of Set built-in via factory function.
|
|
196
|
-
*
|
|
197
|
-
* Since constructors cannot be safely captured via Object.assign, this module
|
|
198
|
-
* provides a factory function that uses Reflect.construct internally.
|
|
199
|
-
*
|
|
200
|
-
* These references are captured at module initialization time to protect against
|
|
201
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
202
|
-
*
|
|
203
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/set
|
|
204
|
-
*/
|
|
205
|
-
// Capture references at module initialization time
|
|
206
|
-
const _Set = globalThis.Set;
|
|
207
|
-
const _Reflect = globalThis.Reflect;
|
|
208
|
-
/**
|
|
209
|
-
* (Safe copy) Creates a new Set using the captured Set constructor.
|
|
210
|
-
* Use this instead of `new Set()`.
|
|
211
|
-
*
|
|
212
|
-
* @param iterable - Optional iterable of values.
|
|
213
|
-
* @returns A new Set instance.
|
|
214
|
-
*/
|
|
215
|
-
const createSet = (iterable) => _Reflect.construct(_Set, iterable ? [iterable] : []);
|
|
216
|
-
|
|
217
|
-
const registeredClasses = [];
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Returns the data type of the target.
|
|
221
|
-
* Uses native `typeof` operator, however, makes distinction between `null`, `array`, and `object`.
|
|
222
|
-
* Also, when classes are registered via `registerClass`, it checks if objects are instance of any known registered class.
|
|
223
|
-
*
|
|
224
|
-
* @param target - The target to get the data type of.
|
|
225
|
-
* @returns The data type of the target.
|
|
226
|
-
*/
|
|
227
|
-
const getType = (target) => {
|
|
228
|
-
if (target === null)
|
|
229
|
-
return 'null';
|
|
230
|
-
const nativeDataType = typeof target;
|
|
231
|
-
if (nativeDataType === 'object') {
|
|
232
|
-
if (isArray(target))
|
|
233
|
-
return 'array';
|
|
234
|
-
for (const registeredClass of registeredClasses) {
|
|
235
|
-
if (target instanceof registeredClass)
|
|
236
|
-
return registeredClass.name;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
return nativeDataType;
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
243
|
-
/**
|
|
244
|
-
* Creates a wrapper function that only executes the wrapped function if the condition function returns true.
|
|
245
|
-
*
|
|
246
|
-
* @param func - The function to be conditionally executed.
|
|
247
|
-
* @param conditionFunc - A function that returns a boolean, determining if `func` should be executed.
|
|
248
|
-
* @returns A wrapped version of `func` that executes conditionally.
|
|
249
|
-
*/
|
|
250
|
-
function createConditionalExecutionFunction(func, conditionFunc) {
|
|
251
|
-
return function (...args) {
|
|
252
|
-
if (conditionFunc()) {
|
|
253
|
-
return func(...args);
|
|
254
|
-
}
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
259
|
-
/**
|
|
260
|
-
* Creates a wrapper function that silently ignores any errors thrown by the wrapped void function.
|
|
261
|
-
* This function is specifically for wrapping functions that do not return a value (void functions).
|
|
262
|
-
* Exceptions are swallowed without any logging or handling.
|
|
263
|
-
*
|
|
264
|
-
* @param func - The void function to be wrapped.
|
|
265
|
-
* @returns A wrapped version of the input function that ignores errors.
|
|
266
|
-
*/
|
|
267
|
-
function createErrorIgnoringFunction(func) {
|
|
268
|
-
return function (...args) {
|
|
269
|
-
try {
|
|
270
|
-
func(...args);
|
|
271
|
-
}
|
|
272
|
-
catch {
|
|
273
|
-
// Deliberately swallowing/ignoring the exception
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
279
|
-
/**
|
|
280
|
-
* A no-operation function (noop) that does nothing regardless of the arguments passed.
|
|
281
|
-
* It is designed to be as permissive as possible in its typing without using the `Function` keyword.
|
|
282
|
-
*
|
|
283
|
-
* @param args - Any arguments passed to the function (ignored)
|
|
284
|
-
*/
|
|
285
|
-
const noop = (...args) => {
|
|
286
|
-
// Intentionally does nothing
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
const logLevels = ['none', 'error', 'warn', 'log', 'info', 'debug'];
|
|
290
|
-
const priority = {
|
|
291
|
-
error: 4,
|
|
292
|
-
warn: 3,
|
|
293
|
-
log: 2,
|
|
294
|
-
info: 1,
|
|
295
|
-
debug: 0,
|
|
296
|
-
};
|
|
297
|
-
/**
|
|
298
|
-
* Validates whether a given string is a valid log level.
|
|
299
|
-
*
|
|
300
|
-
* @param level - The log level to validate
|
|
301
|
-
* @returns True if the level is valid, false otherwise
|
|
302
|
-
*/
|
|
303
|
-
function isValidLogLevel(level) {
|
|
304
|
-
return logLevels.includes(level);
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Creates a log level configuration manager for controlling logging behavior.
|
|
308
|
-
* Provides methods to get, set, and evaluate log levels based on priority.
|
|
309
|
-
*
|
|
310
|
-
* @param level - The initial log level (defaults to 'error')
|
|
311
|
-
* @returns A configuration object with log level management methods
|
|
312
|
-
* @throws {Error} When the provided level is not a valid log level
|
|
313
|
-
*/
|
|
314
|
-
function createLogLevelConfig(level = 'error') {
|
|
315
|
-
if (!isValidLogLevel(level)) {
|
|
316
|
-
throw createError('Cannot create log level configuration with a valid default log level');
|
|
317
|
-
}
|
|
318
|
-
const state = { level };
|
|
319
|
-
const getLogLevel = () => state.level;
|
|
320
|
-
const setLogLevel = (level) => {
|
|
321
|
-
if (!isValidLogLevel(level)) {
|
|
322
|
-
throw createError(`Cannot set value '${level}' level. Expected levels are ${logLevels}.`);
|
|
323
|
-
}
|
|
324
|
-
state.level = level;
|
|
325
|
-
};
|
|
326
|
-
const shouldLog = (level) => {
|
|
327
|
-
if (state.level === 'none' || level === 'none' || !isValidLogLevel(level)) {
|
|
328
|
-
return false;
|
|
329
|
-
}
|
|
330
|
-
return priority[level] >= priority[state.level];
|
|
331
|
-
};
|
|
332
|
-
return freeze({
|
|
333
|
-
getLogLevel,
|
|
334
|
-
setLogLevel,
|
|
335
|
-
shouldLog,
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
/**
|
|
340
|
-
* Creates a logger instance with configurable log level filtering.
|
|
341
|
-
* Each log function is wrapped to respect the current log level setting.
|
|
342
|
-
*
|
|
343
|
-
* @param error - Function to handle error-level logs (required)
|
|
344
|
-
* @param warn - Function to handle warning-level logs (optional, defaults to noop)
|
|
345
|
-
* @param log - Function to handle standard logs (optional, defaults to noop)
|
|
346
|
-
* @param info - Function to handle info-level logs (optional, defaults to noop)
|
|
347
|
-
* @param debug - Function to handle debug-level logs (optional, defaults to noop)
|
|
348
|
-
* @returns A frozen logger object with log methods and level control
|
|
349
|
-
* @throws {ErrorLevelFn} When any provided log function is invalid
|
|
350
|
-
*/
|
|
351
|
-
function createLogger(error, warn = noop, log = noop, info = noop, debug = noop) {
|
|
352
|
-
if (notValidLogFn(error)) {
|
|
353
|
-
throw createError(notFnMsg('error'));
|
|
354
|
-
}
|
|
355
|
-
if (notValidLogFn(warn)) {
|
|
356
|
-
throw createError(notFnMsg('warn'));
|
|
357
|
-
}
|
|
358
|
-
if (notValidLogFn(log)) {
|
|
359
|
-
throw createError(notFnMsg('log'));
|
|
360
|
-
}
|
|
361
|
-
if (notValidLogFn(info)) {
|
|
362
|
-
throw createError(notFnMsg('info'));
|
|
363
|
-
}
|
|
364
|
-
if (notValidLogFn(debug)) {
|
|
365
|
-
throw createError(notFnMsg('debug'));
|
|
366
|
-
}
|
|
367
|
-
const { setLogLevel, getLogLevel, shouldLog } = createLogLevelConfig();
|
|
368
|
-
const wrapLogFn = (fn, level) => {
|
|
369
|
-
if (fn === noop)
|
|
370
|
-
return fn;
|
|
371
|
-
const condition = () => shouldLog(level);
|
|
372
|
-
return createConditionalExecutionFunction(createErrorIgnoringFunction(fn), condition);
|
|
373
|
-
};
|
|
374
|
-
return freeze({
|
|
375
|
-
error: wrapLogFn(error, 'error'),
|
|
376
|
-
warn: wrapLogFn(warn, 'warn'),
|
|
377
|
-
log: wrapLogFn(log, 'log'),
|
|
378
|
-
info: wrapLogFn(info, 'info'),
|
|
379
|
-
debug: wrapLogFn(debug, 'debug'),
|
|
380
|
-
setLogLevel,
|
|
381
|
-
getLogLevel,
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
/**
|
|
385
|
-
* Validates whether a given value is a valid log function.
|
|
386
|
-
*
|
|
387
|
-
* @param fn - The value to validate
|
|
388
|
-
* @returns True if the value is not a function (invalid), false if it is valid
|
|
389
|
-
*/
|
|
390
|
-
function notValidLogFn(fn) {
|
|
391
|
-
return getType(fn) !== 'function' && fn !== noop;
|
|
392
|
-
}
|
|
393
|
-
/**
|
|
394
|
-
* Generates an error message for invalid log function parameters.
|
|
395
|
-
*
|
|
396
|
-
* @param label - The name of the log function that failed validation
|
|
397
|
-
* @returns A formatted error message string
|
|
398
|
-
*/
|
|
399
|
-
function notFnMsg(label) {
|
|
400
|
-
return `Cannot create a logger when ${label} is not a function`;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
createLogger(error, warn, log, info, debug);
|
|
3
|
+
const node_path = require('node:path');
|
|
4
|
+
const index_cjs_js$5 = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/json/index.cjs.js');
|
|
5
|
+
const index_cjs_js$7 = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.cjs.js');
|
|
6
|
+
const index_cjs_js$2 = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/object/index.cjs.js');
|
|
7
|
+
const node_fs = require('node:fs');
|
|
8
|
+
const index_cjs_js$4 = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/array/index.cjs.js');
|
|
9
|
+
const index_cjs_js$3 = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/console/index.cjs.js');
|
|
10
|
+
const index_cjs_js = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.cjs.js');
|
|
11
|
+
const index_cjs_js$1 = require('../../_dependencies/@hyperfrontend/logging/index.cjs.js');
|
|
12
|
+
const index_cjs_js$6 = 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 { collectAllDependencies, parseVersionString } = require('../../_shared/tech/shared-utils/detector-helpers/index.cjs.js');
|
|
404
15
|
|
|
405
16
|
/**
|
|
406
17
|
* Global log level registry.
|
|
407
18
|
* Tracks all created scoped loggers to allow global log level changes.
|
|
408
19
|
*/
|
|
409
|
-
const loggerRegistry = createSet();
|
|
20
|
+
const loggerRegistry = index_cjs_js.createSet();
|
|
410
21
|
/** Redacted placeholder for sensitive values */
|
|
411
22
|
const REDACTED = '[REDACTED]';
|
|
412
23
|
/**
|
|
@@ -440,17 +51,24 @@ function isSensitiveKey(key) {
|
|
|
440
51
|
*
|
|
441
52
|
* @param obj - Object to sanitize
|
|
442
53
|
* @returns New object with sensitive values redacted
|
|
54
|
+
*
|
|
55
|
+
* @example Sanitizing sensitive data
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const config = { apiKey: 'secret123', endpoint: 'https://api.example.com' }
|
|
58
|
+
* const safe = sanitize(config)
|
|
59
|
+
* // => { apiKey: '[REDACTED]', endpoint: 'https://api.example.com' }
|
|
60
|
+
* ```
|
|
443
61
|
*/
|
|
444
62
|
function sanitize(obj) {
|
|
445
63
|
if (obj === null || obj === undefined) {
|
|
446
64
|
return obj;
|
|
447
65
|
}
|
|
448
|
-
if (isArray(obj)) {
|
|
66
|
+
if (index_cjs_js$4.isArray(obj)) {
|
|
449
67
|
return obj.map((item) => sanitize(item));
|
|
450
68
|
}
|
|
451
69
|
if (typeof obj === 'object') {
|
|
452
70
|
const result = {};
|
|
453
|
-
for (const [key, value] of entries(obj)) {
|
|
71
|
+
for (const [key, value] of index_cjs_js$2.entries(obj)) {
|
|
454
72
|
if (isSensitiveKey(key)) {
|
|
455
73
|
result[key] = REDACTED;
|
|
456
74
|
}
|
|
@@ -475,9 +93,9 @@ function sanitize(obj) {
|
|
|
475
93
|
*/
|
|
476
94
|
function formatMessage(namespace, message, meta) {
|
|
477
95
|
const prefix = `[${namespace}]`;
|
|
478
|
-
if (meta && keys(meta).length > 0) {
|
|
96
|
+
if (meta && index_cjs_js$2.keys(meta).length > 0) {
|
|
479
97
|
const sanitizedMeta = sanitize(meta);
|
|
480
|
-
return `${prefix} ${message} ${stringify(sanitizedMeta)}`;
|
|
98
|
+
return `${prefix} ${message} ${index_cjs_js$5.stringify(sanitizedMeta)}`;
|
|
481
99
|
}
|
|
482
100
|
return `${prefix} ${message}`;
|
|
483
101
|
}
|
|
@@ -490,7 +108,7 @@ function formatMessage(namespace, message, meta) {
|
|
|
490
108
|
* @param options - Logger configuration options
|
|
491
109
|
* @returns A configured scoped logger instance
|
|
492
110
|
*
|
|
493
|
-
* @example
|
|
111
|
+
* @example Creating a scoped logger
|
|
494
112
|
* ```typescript
|
|
495
113
|
* const logger = createScopedLogger('project-scope')
|
|
496
114
|
* logger.setLogLevel('debug')
|
|
@@ -505,16 +123,13 @@ function formatMessage(namespace, message, meta) {
|
|
|
505
123
|
*/
|
|
506
124
|
function createScopedLogger(namespace, options = {}) {
|
|
507
125
|
const { level = 'error', sanitizeSecrets = true } = options;
|
|
508
|
-
// Create wrapper functions that add namespace prefix and sanitization
|
|
509
126
|
const createLogFn = (baseFn) => (message, meta) => {
|
|
510
127
|
const processedMeta = sanitizeSecrets && meta ? sanitize(meta) : meta;
|
|
511
128
|
baseFn(formatMessage(namespace, message, processedMeta));
|
|
512
129
|
};
|
|
513
|
-
|
|
514
|
-
const baseLogger = createLogger(createLogFn(error), createLogFn(warn), createLogFn(log), createLogFn(info), createLogFn(debug));
|
|
515
|
-
// Set initial log level (use global override if set)
|
|
130
|
+
const baseLogger = index_cjs_js$1.createLogger(createLogFn(index_cjs_js$3.error), createLogFn(index_cjs_js$3.warn), createLogFn(index_cjs_js$3.log), createLogFn(index_cjs_js$3.info), createLogFn(index_cjs_js$3.debug));
|
|
516
131
|
baseLogger.setLogLevel(level);
|
|
517
|
-
const scopedLogger = freeze({
|
|
132
|
+
const scopedLogger = index_cjs_js$2.freeze({
|
|
518
133
|
error: (message, meta) => baseLogger.error(message, meta),
|
|
519
134
|
warn: (message, meta) => baseLogger.warn(message, meta),
|
|
520
135
|
log: (message, meta) => baseLogger.log(message, meta),
|
|
@@ -523,7 +138,6 @@ function createScopedLogger(namespace, options = {}) {
|
|
|
523
138
|
setLogLevel: baseLogger.setLogLevel,
|
|
524
139
|
getLogLevel: baseLogger.getLogLevel,
|
|
525
140
|
});
|
|
526
|
-
// Register logger for global level management
|
|
527
141
|
loggerRegistry.add(scopedLogger);
|
|
528
142
|
return scopedLogger;
|
|
529
143
|
}
|
|
@@ -531,7 +145,7 @@ function createScopedLogger(namespace, options = {}) {
|
|
|
531
145
|
* Default logger instance for the project-scope library.
|
|
532
146
|
* Use this for general logging within the library.
|
|
533
147
|
*
|
|
534
|
-
* @example
|
|
148
|
+
* @example Using the default logger
|
|
535
149
|
* ```typescript
|
|
536
150
|
* import { logger } from '@hyperfrontend/project-scope/core'
|
|
537
151
|
*
|
|
@@ -549,10 +163,19 @@ createScopedLogger('project-scope:fs');
|
|
|
549
163
|
* @param code - The category code for this type of filesystem failure
|
|
550
164
|
* @param context - Additional context including path, operation, and cause
|
|
551
165
|
* @returns A configured Error object with code and context properties
|
|
166
|
+
*
|
|
167
|
+
* @example Creating a file system error
|
|
168
|
+
* ```typescript
|
|
169
|
+
* throw createFileSystemError(
|
|
170
|
+
* 'Cannot read file',
|
|
171
|
+
* 'FS_READ_ERROR',
|
|
172
|
+
* { path: './missing.txt', operation: 'read' }
|
|
173
|
+
* )
|
|
174
|
+
* ```
|
|
552
175
|
*/
|
|
553
176
|
function createFileSystemError(message, code, context) {
|
|
554
|
-
const error = createError(message);
|
|
555
|
-
defineProperties(error, {
|
|
177
|
+
const error = index_cjs_js$6.createError(message);
|
|
178
|
+
index_cjs_js$2.defineProperties(error, {
|
|
556
179
|
code: { value: code, enumerable: true },
|
|
557
180
|
context: { value: context, enumerable: true },
|
|
558
181
|
});
|
|
@@ -564,6 +187,14 @@ function createFileSystemError(message, code, context) {
|
|
|
564
187
|
* @param filePath - Path to file
|
|
565
188
|
* @param encoding - File encoding (default: utf-8)
|
|
566
189
|
* @returns File contents or null if file doesn't exist
|
|
190
|
+
*
|
|
191
|
+
* @example Reading file if it exists
|
|
192
|
+
* ```typescript
|
|
193
|
+
* const content = readFileIfExists('./optional-config.json')
|
|
194
|
+
* if (content) {
|
|
195
|
+
* // File existed, use content
|
|
196
|
+
* }
|
|
197
|
+
* ```
|
|
567
198
|
*/
|
|
568
199
|
function readFileIfExists(filePath, encoding = 'utf-8') {
|
|
569
200
|
if (!node_fs.existsSync(filePath)) {
|
|
@@ -577,56 +208,6 @@ function readFileIfExists(filePath, encoding = 'utf-8') {
|
|
|
577
208
|
}
|
|
578
209
|
}
|
|
579
210
|
|
|
580
|
-
createScopedLogger('project-scope:fs:write');
|
|
581
|
-
|
|
582
|
-
/**
|
|
583
|
-
* Get file stats with error handling.
|
|
584
|
-
*
|
|
585
|
-
* @param filePath - Path to file
|
|
586
|
-
* @param followSymlinks - Whether to follow symlinks (default: true)
|
|
587
|
-
* @returns File stats or null if path doesn't exist
|
|
588
|
-
*/
|
|
589
|
-
function getFileStat(filePath, followSymlinks = true) {
|
|
590
|
-
if (!node_fs.existsSync(filePath)) {
|
|
591
|
-
return null;
|
|
592
|
-
}
|
|
593
|
-
try {
|
|
594
|
-
const stat = followSymlinks ? node_fs.statSync(filePath) : node_fs.lstatSync(filePath);
|
|
595
|
-
return {
|
|
596
|
-
isFile: stat.isFile(),
|
|
597
|
-
isDirectory: stat.isDirectory(),
|
|
598
|
-
isSymlink: stat.isSymbolicLink(),
|
|
599
|
-
size: stat.size,
|
|
600
|
-
created: stat.birthtime,
|
|
601
|
-
modified: stat.mtime,
|
|
602
|
-
accessed: stat.atime,
|
|
603
|
-
mode: stat.mode,
|
|
604
|
-
};
|
|
605
|
-
}
|
|
606
|
-
catch {
|
|
607
|
-
return null;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
/**
|
|
611
|
-
* Check if path is a directory.
|
|
612
|
-
*
|
|
613
|
-
* @param dirPath - Path to check
|
|
614
|
-
* @returns True if path is a directory
|
|
615
|
-
*/
|
|
616
|
-
function isDirectory(dirPath) {
|
|
617
|
-
const stats = getFileStat(dirPath);
|
|
618
|
-
return stats?.isDirectory ?? false;
|
|
619
|
-
}
|
|
620
|
-
/**
|
|
621
|
-
* Check if path exists.
|
|
622
|
-
*
|
|
623
|
-
* @param filePath - Path to check
|
|
624
|
-
* @returns True if path exists
|
|
625
|
-
*/
|
|
626
|
-
function exists(filePath) {
|
|
627
|
-
return node_fs.existsSync(filePath);
|
|
628
|
-
}
|
|
629
|
-
|
|
630
211
|
const fsDirLogger = createScopedLogger('project-scope:fs:dir');
|
|
631
212
|
/**
|
|
632
213
|
* List immediate contents of a directory.
|
|
@@ -635,7 +216,7 @@ const fsDirLogger = createScopedLogger('project-scope:fs:dir');
|
|
|
635
216
|
* @returns Array of entries with metadata for each file/directory
|
|
636
217
|
* @throws {Error} If directory doesn't exist or isn't a directory
|
|
637
218
|
*
|
|
638
|
-
* @example
|
|
219
|
+
* @example Listing directory contents
|
|
639
220
|
* ```typescript
|
|
640
221
|
* import { readDirectory } from '@hyperfrontend/project-scope'
|
|
641
222
|
*
|
|
@@ -678,6 +259,8 @@ function readDirectory(dirPath) {
|
|
|
678
259
|
|
|
679
260
|
createScopedLogger('project-scope:fs:traversal');
|
|
680
261
|
|
|
262
|
+
createScopedLogger('project-scope:fs:write');
|
|
263
|
+
|
|
681
264
|
const packageLogger = createScopedLogger('project-scope:project:package');
|
|
682
265
|
/**
|
|
683
266
|
* Verifies that a value is an object with only string values,
|
|
@@ -689,7 +272,7 @@ const packageLogger = createScopedLogger('project-scope:project:package');
|
|
|
689
272
|
function isStringRecord(value) {
|
|
690
273
|
if (typeof value !== 'object' || value === null)
|
|
691
274
|
return false;
|
|
692
|
-
return values(value).every((v) => typeof v === 'string');
|
|
275
|
+
return index_cjs_js$2.values(value).every((v) => typeof v === 'string');
|
|
693
276
|
}
|
|
694
277
|
/**
|
|
695
278
|
* Extracts and normalizes the workspaces field from package.json,
|
|
@@ -699,12 +282,12 @@ function isStringRecord(value) {
|
|
|
699
282
|
* @returns Normalized workspace patterns or undefined if invalid
|
|
700
283
|
*/
|
|
701
284
|
function parseWorkspaces(value) {
|
|
702
|
-
if (isArray(value) && value.every((v) => typeof v === 'string')) {
|
|
285
|
+
if (index_cjs_js$4.isArray(value) && value.every((v) => typeof v === 'string')) {
|
|
703
286
|
return value;
|
|
704
287
|
}
|
|
705
288
|
if (typeof value === 'object' && value !== null) {
|
|
706
289
|
const obj = value;
|
|
707
|
-
if (isArray(obj['packages'])) {
|
|
290
|
+
if (index_cjs_js$4.isArray(obj['packages'])) {
|
|
708
291
|
return { packages: obj['packages'] };
|
|
709
292
|
}
|
|
710
293
|
}
|
|
@@ -718,7 +301,7 @@ function parseWorkspaces(value) {
|
|
|
718
301
|
*/
|
|
719
302
|
function validatePackageJson(data) {
|
|
720
303
|
if (typeof data !== 'object' || data === null) {
|
|
721
|
-
throw createError('package.json must be an object');
|
|
304
|
+
throw index_cjs_js$6.createError('package.json must be an object');
|
|
722
305
|
}
|
|
723
306
|
const pkg = data;
|
|
724
307
|
return {
|
|
@@ -747,6 +330,16 @@ function validatePackageJson(data) {
|
|
|
747
330
|
*
|
|
748
331
|
* @param projectPath - Project directory path or path to package.json
|
|
749
332
|
* @returns Parsed package.json or null if not found
|
|
333
|
+
*
|
|
334
|
+
* @example Reading package.json if it exists
|
|
335
|
+
* ```typescript
|
|
336
|
+
* import { readPackageJsonIfExists } from '@hyperfrontend/project-scope'
|
|
337
|
+
*
|
|
338
|
+
* const pkg = readPackageJsonIfExists('/path/to/project')
|
|
339
|
+
* if (pkg) {
|
|
340
|
+
* console.log('Found:', pkg.name)
|
|
341
|
+
* }
|
|
342
|
+
* ```
|
|
750
343
|
*/
|
|
751
344
|
function readPackageJsonIfExists(projectPath) {
|
|
752
345
|
const packageJsonPath = projectPath.endsWith('package.json') ? projectPath : node_path.join(projectPath, 'package.json');
|
|
@@ -756,7 +349,7 @@ function readPackageJsonIfExists(projectPath) {
|
|
|
756
349
|
return null;
|
|
757
350
|
}
|
|
758
351
|
try {
|
|
759
|
-
const validated = validatePackageJson(parse(content));
|
|
352
|
+
const validated = validatePackageJson(index_cjs_js$5.parse(content));
|
|
760
353
|
packageLogger.debug('Package.json loaded', { path: packageJsonPath, name: validated.name });
|
|
761
354
|
return validated;
|
|
762
355
|
}
|
|
@@ -766,44 +359,6 @@ function readPackageJsonIfExists(projectPath) {
|
|
|
766
359
|
}
|
|
767
360
|
}
|
|
768
361
|
|
|
769
|
-
/**
|
|
770
|
-
* Get combined dependencies from package.json.
|
|
771
|
-
* Merges dependencies, devDependencies, peerDependencies, and optionalDependencies.
|
|
772
|
-
*
|
|
773
|
-
* @param packageJson - The package.json object to extract dependencies from
|
|
774
|
-
* @returns Combined dependencies as a single record
|
|
775
|
-
*/
|
|
776
|
-
function collectAllDependencies(packageJson) {
|
|
777
|
-
return {
|
|
778
|
-
...packageJson?.dependencies,
|
|
779
|
-
...packageJson?.devDependencies,
|
|
780
|
-
...packageJson?.peerDependencies,
|
|
781
|
-
...packageJson?.optionalDependencies,
|
|
782
|
-
};
|
|
783
|
-
}
|
|
784
|
-
/**
|
|
785
|
-
* Extract clean version from dependency version string.
|
|
786
|
-
* Removes semver prefixes like ^, ~, >=, etc.
|
|
787
|
-
* Uses character-by-character parsing to avoid ReDoS vulnerabilities.
|
|
788
|
-
*
|
|
789
|
-
* @param versionString - The version string with optional prefix characters
|
|
790
|
-
* @returns The cleaned version string without prefix characters
|
|
791
|
-
*/
|
|
792
|
-
function parseVersionString(versionString) {
|
|
793
|
-
if (versionString === undefined || versionString === null)
|
|
794
|
-
return undefined;
|
|
795
|
-
// Manual parsing instead of regex to avoid ReDoS
|
|
796
|
-
let start = 0;
|
|
797
|
-
while (start < versionString.length) {
|
|
798
|
-
const char = versionString[start];
|
|
799
|
-
if (char !== '^' && char !== '~' && char !== '>' && char !== '=' && char !== '<') {
|
|
800
|
-
break;
|
|
801
|
-
}
|
|
802
|
-
start++;
|
|
803
|
-
}
|
|
804
|
-
return versionString.slice(start);
|
|
805
|
-
}
|
|
806
|
-
|
|
807
362
|
/**
|
|
808
363
|
* Check if tsconfig has strict mode enabled.
|
|
809
364
|
*
|
|
@@ -816,9 +371,8 @@ function checkTsConfigStrict(projectPath) {
|
|
|
816
371
|
if (!content)
|
|
817
372
|
return undefined;
|
|
818
373
|
try {
|
|
819
|
-
// Simple JSON parsing - doesn't handle comments but good enough for strict check
|
|
820
374
|
const cleanContent = content.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g, '');
|
|
821
|
-
const parsed = parse(cleanContent);
|
|
375
|
+
const parsed = index_cjs_js$5.parse(cleanContent);
|
|
822
376
|
return parsed?.compilerOptions?.strict === true;
|
|
823
377
|
}
|
|
824
378
|
catch {
|
|
@@ -831,6 +385,19 @@ function checkTsConfigStrict(projectPath) {
|
|
|
831
385
|
* @param projectPath - Project directory path
|
|
832
386
|
* @param packageJson - Optional pre-loaded package.json
|
|
833
387
|
* @returns Detection result or null if not detected
|
|
388
|
+
*
|
|
389
|
+
* @example Detecting TypeScript
|
|
390
|
+
* ```typescript
|
|
391
|
+
* import { typescriptDetector } from '@hyperfrontend/project-scope'
|
|
392
|
+
*
|
|
393
|
+
* const result = typescriptDetector('./my-project')
|
|
394
|
+
* if (result) {
|
|
395
|
+
* console.log(`TypeScript ${result.version}`)
|
|
396
|
+
* console.log(`Strict mode: ${result.strictMode ?? 'unknown'}`)
|
|
397
|
+
* // => "TypeScript 5.3.0"
|
|
398
|
+
* // => "Strict mode: true"
|
|
399
|
+
* }
|
|
400
|
+
* ```
|
|
834
401
|
*/
|
|
835
402
|
function typescriptDetector(projectPath, packageJson) {
|
|
836
403
|
const pkg = packageJson ?? readPackageJsonIfExists(projectPath);
|
|
@@ -839,19 +406,16 @@ function typescriptDetector(projectPath, packageJson) {
|
|
|
839
406
|
let configPath;
|
|
840
407
|
let version;
|
|
841
408
|
const deps = collectAllDependencies(pkg);
|
|
842
|
-
// TypeScript package
|
|
843
409
|
if (deps['typescript']) {
|
|
844
410
|
confidence += 50;
|
|
845
411
|
version = parseVersionString(deps['typescript']);
|
|
846
412
|
sources.push({ type: 'package.json', field: 'dependencies.typescript' });
|
|
847
413
|
}
|
|
848
|
-
// tsconfig.json
|
|
849
414
|
if (exists(node_path.join(projectPath, 'tsconfig.json'))) {
|
|
850
415
|
confidence += 40;
|
|
851
416
|
configPath = 'tsconfig.json';
|
|
852
417
|
sources.push({ type: 'config-file', path: 'tsconfig.json' });
|
|
853
418
|
}
|
|
854
|
-
// tsconfig.*.json variants
|
|
855
419
|
const tsconfigVariants = ['tsconfig.build.json', 'tsconfig.lib.json', 'tsconfig.spec.json', 'tsconfig.app.json'];
|
|
856
420
|
for (const variant of tsconfigVariants) {
|
|
857
421
|
if (exists(node_path.join(projectPath, variant))) {
|
|
@@ -860,8 +424,7 @@ function typescriptDetector(projectPath, packageJson) {
|
|
|
860
424
|
break;
|
|
861
425
|
}
|
|
862
426
|
}
|
|
863
|
-
|
|
864
|
-
const typePackages = keys(deps).filter((d) => d.startsWith('@types/'));
|
|
427
|
+
const typePackages = index_cjs_js$2.keys(deps).filter((d) => d.startsWith('@types/'));
|
|
865
428
|
if (typePackages.length > 0) {
|
|
866
429
|
confidence += 10;
|
|
867
430
|
sources.push({ type: 'package.json', field: '@types/* packages' });
|
|
@@ -876,7 +439,7 @@ function typescriptDetector(projectPath, packageJson) {
|
|
|
876
439
|
version,
|
|
877
440
|
configPath,
|
|
878
441
|
strictMode,
|
|
879
|
-
confidence: min(confidence, 100),
|
|
442
|
+
confidence: index_cjs_js$7.min(confidence, 100),
|
|
880
443
|
detectedFrom: sources,
|
|
881
444
|
};
|
|
882
445
|
}
|
|
@@ -886,6 +449,17 @@ function typescriptDetector(projectPath, packageJson) {
|
|
|
886
449
|
* @param projectPath - Project directory path
|
|
887
450
|
* @param packageJson - Optional pre-loaded package.json
|
|
888
451
|
* @returns Detection result or null if not detected
|
|
452
|
+
*
|
|
453
|
+
* @example Detecting Flow type system
|
|
454
|
+
* ```typescript
|
|
455
|
+
* import { flowDetector } from '@hyperfrontend/project-scope'
|
|
456
|
+
*
|
|
457
|
+
* const result = flowDetector('./my-project')
|
|
458
|
+
* if (result) {
|
|
459
|
+
* console.log(`Flow ${result.version} with config: ${result.configPath}`)
|
|
460
|
+
* // => "Flow 0.232.0 with config: .flowconfig"
|
|
461
|
+
* }
|
|
462
|
+
* ```
|
|
889
463
|
*/
|
|
890
464
|
function flowDetector(projectPath, packageJson) {
|
|
891
465
|
const pkg = packageJson ?? readPackageJsonIfExists(projectPath);
|
|
@@ -894,24 +468,20 @@ function flowDetector(projectPath, packageJson) {
|
|
|
894
468
|
let configPath;
|
|
895
469
|
let version;
|
|
896
470
|
const deps = collectAllDependencies(pkg);
|
|
897
|
-
// flow-bin package
|
|
898
471
|
if (deps['flow-bin']) {
|
|
899
472
|
confidence += 60;
|
|
900
473
|
version = parseVersionString(deps['flow-bin']);
|
|
901
474
|
sources.push({ type: 'package.json', field: 'dependencies.flow-bin' });
|
|
902
475
|
}
|
|
903
|
-
// .flowconfig
|
|
904
476
|
if (exists(node_path.join(projectPath, '.flowconfig'))) {
|
|
905
477
|
confidence += 40;
|
|
906
478
|
configPath = '.flowconfig';
|
|
907
479
|
sources.push({ type: 'config-file', path: '.flowconfig' });
|
|
908
480
|
}
|
|
909
|
-
// flow-typed directory
|
|
910
481
|
if (exists(node_path.join(projectPath, 'flow-typed'))) {
|
|
911
482
|
confidence += 10;
|
|
912
483
|
sources.push({ type: 'directory', path: 'flow-typed/' });
|
|
913
484
|
}
|
|
914
|
-
// @babel/preset-flow
|
|
915
485
|
if (deps['@babel/preset-flow']) {
|
|
916
486
|
confidence += 10;
|
|
917
487
|
sources.push({ type: 'package.json', field: 'dependencies.@babel/preset-flow' });
|
|
@@ -924,7 +494,7 @@ function flowDetector(projectPath, packageJson) {
|
|
|
924
494
|
name: 'Flow',
|
|
925
495
|
version,
|
|
926
496
|
configPath,
|
|
927
|
-
confidence: min(confidence, 100),
|
|
497
|
+
confidence: index_cjs_js$7.min(confidence, 100),
|
|
928
498
|
detectedFrom: sources,
|
|
929
499
|
};
|
|
930
500
|
}
|
|
@@ -935,7 +505,6 @@ function flowDetector(projectPath, packageJson) {
|
|
|
935
505
|
* @returns `true` if the content contains JSDoc type annotations.
|
|
936
506
|
*/
|
|
937
507
|
function hasJsDocTypes(content) {
|
|
938
|
-
// Check for JSDoc type annotations
|
|
939
508
|
return (content.includes('@type {') ||
|
|
940
509
|
content.includes('@param {') ||
|
|
941
510
|
content.includes('@returns {') ||
|
|
@@ -948,26 +517,35 @@ function hasJsDocTypes(content) {
|
|
|
948
517
|
* @param projectPath - Project directory path
|
|
949
518
|
* @param packageJson - Optional pre-loaded package.json
|
|
950
519
|
* @returns Detection result or null if not detected
|
|
520
|
+
*
|
|
521
|
+
* @example Detecting JSDoc type annotations
|
|
522
|
+
* ```typescript
|
|
523
|
+
* import { jsdocDetector } from '@hyperfrontend/project-scope'
|
|
524
|
+
*
|
|
525
|
+
* const result = jsdocDetector('./my-project')
|
|
526
|
+
* if (result) {
|
|
527
|
+
* console.log('JSDoc types detected')
|
|
528
|
+
* console.log('Sources:', result.detectedFrom.map(s => s.path ?? s.field))
|
|
529
|
+
* // => "Sources: ['jsconfig.json', 'src/utils.js (JSDoc annotations)']"
|
|
530
|
+
* }
|
|
531
|
+
* ```
|
|
951
532
|
*/
|
|
952
533
|
function jsdocDetector(projectPath, packageJson) {
|
|
953
534
|
const pkg = packageJson ?? readPackageJsonIfExists(projectPath);
|
|
954
535
|
const sources = [];
|
|
955
536
|
let confidence = 0;
|
|
956
537
|
const deps = collectAllDependencies(pkg);
|
|
957
|
-
// jsdoc package
|
|
958
538
|
if (deps['jsdoc']) {
|
|
959
539
|
confidence += 30;
|
|
960
540
|
sources.push({ type: 'package.json', field: 'dependencies.jsdoc' });
|
|
961
541
|
}
|
|
962
|
-
// typescript with checkJs (JSDoc type checking)
|
|
963
542
|
if (deps['typescript']) {
|
|
964
|
-
// Check if checkJs is enabled in tsconfig
|
|
965
543
|
const tsconfigPath = node_path.join(projectPath, 'tsconfig.json');
|
|
966
544
|
const content = readFileIfExists(tsconfigPath);
|
|
967
545
|
if (content) {
|
|
968
546
|
try {
|
|
969
547
|
const cleanContent = content.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g, '');
|
|
970
|
-
const parsed = parse(cleanContent);
|
|
548
|
+
const parsed = index_cjs_js$5.parse(cleanContent);
|
|
971
549
|
if (parsed?.compilerOptions?.checkJs === true || parsed?.compilerOptions?.allowJs === true) {
|
|
972
550
|
confidence += 30;
|
|
973
551
|
sources.push({ type: 'config-file', path: 'tsconfig.json (checkJs/allowJs)' });
|
|
@@ -978,12 +556,10 @@ function jsdocDetector(projectPath, packageJson) {
|
|
|
978
556
|
}
|
|
979
557
|
}
|
|
980
558
|
}
|
|
981
|
-
// Check for jsconfig.json (VS Code JS type checking)
|
|
982
559
|
if (exists(node_path.join(projectPath, 'jsconfig.json'))) {
|
|
983
560
|
confidence += 40;
|
|
984
561
|
sources.push({ type: 'config-file', path: 'jsconfig.json' });
|
|
985
562
|
}
|
|
986
|
-
// Sample check for JSDoc annotations in source files
|
|
987
563
|
const srcDir = node_path.join(projectPath, 'src');
|
|
988
564
|
if (exists(srcDir)) {
|
|
989
565
|
try {
|
|
@@ -1008,7 +584,7 @@ function jsdocDetector(projectPath, packageJson) {
|
|
|
1008
584
|
return {
|
|
1009
585
|
id: 'jsdoc',
|
|
1010
586
|
name: 'JSDoc',
|
|
1011
|
-
confidence: min(confidence, 100),
|
|
587
|
+
confidence: index_cjs_js$7.min(confidence, 100),
|
|
1012
588
|
detectedFrom: sources,
|
|
1013
589
|
};
|
|
1014
590
|
}
|
|
@@ -1024,6 +600,20 @@ const typeSystemDetectors = [
|
|
|
1024
600
|
* @param projectPath - Project directory path
|
|
1025
601
|
* @param packageJson - Optional pre-loaded package.json
|
|
1026
602
|
* @returns Array of detected type systems, sorted by confidence
|
|
603
|
+
*
|
|
604
|
+
* @example Detecting all type systems
|
|
605
|
+
* ```typescript
|
|
606
|
+
* import { detectTypeSystems } from '@hyperfrontend/project-scope'
|
|
607
|
+
*
|
|
608
|
+
* const typeSystems = detectTypeSystems('./my-project')
|
|
609
|
+
* // => [
|
|
610
|
+
* // { id: 'typescript', name: 'TypeScript', version: '5.3.0', strictMode: true, confidence: 95, ... },
|
|
611
|
+
* // { id: 'jsdoc', name: 'JSDoc', confidence: 40, ... }
|
|
612
|
+
* // ]
|
|
613
|
+
*
|
|
614
|
+
* const primary = typeSystems[0]?.name ?? 'None'
|
|
615
|
+
* console.log(`Primary type system: ${primary}`)
|
|
616
|
+
* ```
|
|
1027
617
|
*/
|
|
1028
618
|
function detectTypeSystems(projectPath, packageJson) {
|
|
1029
619
|
const pkg = packageJson ?? readPackageJsonIfExists(projectPath);
|
|
@@ -1042,4 +632,3 @@ exports.flowDetector = flowDetector;
|
|
|
1042
632
|
exports.jsdocDetector = jsdocDetector;
|
|
1043
633
|
exports.typeSystemDetectors = typeSystemDetectors;
|
|
1044
634
|
exports.typescriptDetector = typescriptDetector;
|
|
1045
|
-
//# sourceMappingURL=index.cjs.js.map
|