@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/nx/index.esm.js
CHANGED
|
@@ -1,412 +1,15 @@
|
|
|
1
1
|
import { join as join$1, resolve, parse as parse$1, dirname, basename, relative } from 'node:path';
|
|
2
2
|
import { existsSync, readFileSync, statSync, lstatSync, readdirSync } from 'node:fs';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/error
|
|
14
|
-
*/
|
|
15
|
-
// Capture references at module initialization time
|
|
16
|
-
const _Error = globalThis.Error;
|
|
17
|
-
const _Reflect$2 = globalThis.Reflect;
|
|
18
|
-
/**
|
|
19
|
-
* (Safe copy) Creates a new Error using the captured Error constructor.
|
|
20
|
-
* Use this instead of `new Error()`.
|
|
21
|
-
*
|
|
22
|
-
* @param message - Optional error message.
|
|
23
|
-
* @param options - Optional error options.
|
|
24
|
-
* @returns A new Error instance.
|
|
25
|
-
*/
|
|
26
|
-
const createError = (message, options) => _Reflect$2.construct(_Error, [message, options]);
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Safe copies of JSON built-in methods.
|
|
30
|
-
*
|
|
31
|
-
* These references are captured at module initialization time to protect against
|
|
32
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
33
|
-
*
|
|
34
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/json
|
|
35
|
-
*/
|
|
36
|
-
// Capture references at module initialization time
|
|
37
|
-
const _JSON = globalThis.JSON;
|
|
38
|
-
/**
|
|
39
|
-
* (Safe copy) Converts a JavaScript Object Notation (JSON) string into an object.
|
|
40
|
-
*/
|
|
41
|
-
const parse = _JSON.parse;
|
|
42
|
-
/**
|
|
43
|
-
* (Safe copy) Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
|
|
44
|
-
*/
|
|
45
|
-
const stringify = _JSON.stringify;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Safe copies of Object built-in methods.
|
|
49
|
-
*
|
|
50
|
-
* These references are captured at module initialization time to protect against
|
|
51
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
52
|
-
*
|
|
53
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/object
|
|
54
|
-
*/
|
|
55
|
-
// Capture references at module initialization time
|
|
56
|
-
const _Object = globalThis.Object;
|
|
57
|
-
/**
|
|
58
|
-
* (Safe copy) Prevents modification of existing property attributes and values,
|
|
59
|
-
* and prevents the addition of new properties.
|
|
60
|
-
*/
|
|
61
|
-
const freeze = _Object.freeze;
|
|
62
|
-
/**
|
|
63
|
-
* (Safe copy) Returns the names of the enumerable string properties and methods of an object.
|
|
64
|
-
*/
|
|
65
|
-
const keys = _Object.keys;
|
|
66
|
-
/**
|
|
67
|
-
* (Safe copy) Returns an array of key/values of the enumerable own properties of an object.
|
|
68
|
-
*/
|
|
69
|
-
const entries = _Object.entries;
|
|
70
|
-
/**
|
|
71
|
-
* (Safe copy) Returns an array of values of the enumerable own properties of an object.
|
|
72
|
-
*/
|
|
73
|
-
const values = _Object.values;
|
|
74
|
-
/**
|
|
75
|
-
* (Safe copy) Adds one or more properties to an object, and/or modifies attributes of existing properties.
|
|
76
|
-
*/
|
|
77
|
-
const defineProperties = _Object.defineProperties;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Safe copies of Array built-in static methods.
|
|
81
|
-
*
|
|
82
|
-
* These references are captured at module initialization time to protect against
|
|
83
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
84
|
-
*
|
|
85
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/array
|
|
86
|
-
*/
|
|
87
|
-
// Capture references at module initialization time
|
|
88
|
-
const _Array = globalThis.Array;
|
|
89
|
-
/**
|
|
90
|
-
* (Safe copy) Determines whether the passed value is an Array.
|
|
91
|
-
*/
|
|
92
|
-
const isArray = _Array.isArray;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Safe copies of Console built-in methods.
|
|
96
|
-
*
|
|
97
|
-
* These references are captured at module initialization time to protect against
|
|
98
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
99
|
-
*
|
|
100
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/console
|
|
101
|
-
*/
|
|
102
|
-
// Capture references at module initialization time
|
|
103
|
-
const _console = globalThis.console;
|
|
104
|
-
/**
|
|
105
|
-
* (Safe copy) Outputs a message to the console.
|
|
106
|
-
*/
|
|
107
|
-
const log = _console.log.bind(_console);
|
|
108
|
-
/**
|
|
109
|
-
* (Safe copy) Outputs a warning message to the console.
|
|
110
|
-
*/
|
|
111
|
-
const warn = _console.warn.bind(_console);
|
|
112
|
-
/**
|
|
113
|
-
* (Safe copy) Outputs an error message to the console.
|
|
114
|
-
*/
|
|
115
|
-
const error = _console.error.bind(_console);
|
|
116
|
-
/**
|
|
117
|
-
* (Safe copy) Outputs an informational message to the console.
|
|
118
|
-
*/
|
|
119
|
-
const info = _console.info.bind(_console);
|
|
120
|
-
/**
|
|
121
|
-
* (Safe copy) Outputs a debug message to the console.
|
|
122
|
-
*/
|
|
123
|
-
const debug = _console.debug.bind(_console);
|
|
124
|
-
/**
|
|
125
|
-
* (Safe copy) Outputs a stack trace to the console.
|
|
126
|
-
*/
|
|
127
|
-
_console.trace.bind(_console);
|
|
128
|
-
/**
|
|
129
|
-
* (Safe copy) Displays an interactive listing of the properties of a specified object.
|
|
130
|
-
*/
|
|
131
|
-
_console.dir.bind(_console);
|
|
132
|
-
/**
|
|
133
|
-
* (Safe copy) Displays tabular data as a table.
|
|
134
|
-
*/
|
|
135
|
-
_console.table.bind(_console);
|
|
136
|
-
/**
|
|
137
|
-
* (Safe copy) Writes an error message to the console if the assertion is false.
|
|
138
|
-
*/
|
|
139
|
-
_console.assert.bind(_console);
|
|
140
|
-
/**
|
|
141
|
-
* (Safe copy) Clears the console.
|
|
142
|
-
*/
|
|
143
|
-
_console.clear.bind(_console);
|
|
144
|
-
/**
|
|
145
|
-
* (Safe copy) Logs the number of times that this particular call to count() has been called.
|
|
146
|
-
*/
|
|
147
|
-
_console.count.bind(_console);
|
|
148
|
-
/**
|
|
149
|
-
* (Safe copy) Resets the counter used with console.count().
|
|
150
|
-
*/
|
|
151
|
-
_console.countReset.bind(_console);
|
|
152
|
-
/**
|
|
153
|
-
* (Safe copy) Creates a new inline group in the console.
|
|
154
|
-
*/
|
|
155
|
-
_console.group.bind(_console);
|
|
156
|
-
/**
|
|
157
|
-
* (Safe copy) Creates a new inline group in the console that is initially collapsed.
|
|
158
|
-
*/
|
|
159
|
-
_console.groupCollapsed.bind(_console);
|
|
160
|
-
/**
|
|
161
|
-
* (Safe copy) Exits the current inline group.
|
|
162
|
-
*/
|
|
163
|
-
_console.groupEnd.bind(_console);
|
|
164
|
-
/**
|
|
165
|
-
* (Safe copy) Starts a timer with a name specified as an input parameter.
|
|
166
|
-
*/
|
|
167
|
-
_console.time.bind(_console);
|
|
168
|
-
/**
|
|
169
|
-
* (Safe copy) Stops a timer that was previously started.
|
|
170
|
-
*/
|
|
171
|
-
_console.timeEnd.bind(_console);
|
|
172
|
-
/**
|
|
173
|
-
* (Safe copy) Logs the current value of a timer that was previously started.
|
|
174
|
-
*/
|
|
175
|
-
_console.timeLog.bind(_console);
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Safe copies of Set built-in via factory function.
|
|
179
|
-
*
|
|
180
|
-
* Since constructors cannot be safely captured via Object.assign, this module
|
|
181
|
-
* provides a factory function that uses Reflect.construct internally.
|
|
182
|
-
*
|
|
183
|
-
* These references are captured at module initialization time to protect against
|
|
184
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
185
|
-
*
|
|
186
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/set
|
|
187
|
-
*/
|
|
188
|
-
// Capture references at module initialization time
|
|
189
|
-
const _Set = globalThis.Set;
|
|
190
|
-
const _Reflect$1 = globalThis.Reflect;
|
|
191
|
-
/**
|
|
192
|
-
* (Safe copy) Creates a new Set using the captured Set constructor.
|
|
193
|
-
* Use this instead of `new Set()`.
|
|
194
|
-
*
|
|
195
|
-
* @param iterable - Optional iterable of values.
|
|
196
|
-
* @returns A new Set instance.
|
|
197
|
-
*/
|
|
198
|
-
const createSet = (iterable) => _Reflect$1.construct(_Set, iterable ? [iterable] : []);
|
|
199
|
-
|
|
200
|
-
const registeredClasses = [];
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Returns the data type of the target.
|
|
204
|
-
* Uses native `typeof` operator, however, makes distinction between `null`, `array`, and `object`.
|
|
205
|
-
* Also, when classes are registered via `registerClass`, it checks if objects are instance of any known registered class.
|
|
206
|
-
*
|
|
207
|
-
* @param target - The target to get the data type of.
|
|
208
|
-
* @returns The data type of the target.
|
|
209
|
-
*/
|
|
210
|
-
const getType = (target) => {
|
|
211
|
-
if (target === null)
|
|
212
|
-
return 'null';
|
|
213
|
-
const nativeDataType = typeof target;
|
|
214
|
-
if (nativeDataType === 'object') {
|
|
215
|
-
if (isArray(target))
|
|
216
|
-
return 'array';
|
|
217
|
-
for (const registeredClass of registeredClasses) {
|
|
218
|
-
if (target instanceof registeredClass)
|
|
219
|
-
return registeredClass.name;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
return nativeDataType;
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Safe copies of Map built-in via factory function.
|
|
227
|
-
*
|
|
228
|
-
* Since constructors cannot be safely captured via Object.assign, this module
|
|
229
|
-
* provides a factory function that uses Reflect.construct internally.
|
|
230
|
-
*
|
|
231
|
-
* These references are captured at module initialization time to protect against
|
|
232
|
-
* prototype pollution attacks. Import only what you need for tree-shaking.
|
|
233
|
-
*
|
|
234
|
-
* @module @hyperfrontend/immutable-api-utils/built-in-copy/map
|
|
235
|
-
*/
|
|
236
|
-
// Capture references at module initialization time
|
|
237
|
-
const _Map = globalThis.Map;
|
|
238
|
-
const _Reflect = globalThis.Reflect;
|
|
239
|
-
/**
|
|
240
|
-
* (Safe copy) Creates a new Map using the captured Map constructor.
|
|
241
|
-
* Use this instead of `new Map()`.
|
|
242
|
-
*
|
|
243
|
-
* @param iterable - Optional iterable of key-value pairs.
|
|
244
|
-
* @returns A new Map instance.
|
|
245
|
-
*/
|
|
246
|
-
const createMap = (iterable) => _Reflect.construct(_Map, iterable ? [iterable] : []);
|
|
247
|
-
|
|
248
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
249
|
-
/**
|
|
250
|
-
* Creates a wrapper function that only executes the wrapped function if the condition function returns true.
|
|
251
|
-
*
|
|
252
|
-
* @param func - The function to be conditionally executed.
|
|
253
|
-
* @param conditionFunc - A function that returns a boolean, determining if `func` should be executed.
|
|
254
|
-
* @returns A wrapped version of `func` that executes conditionally.
|
|
255
|
-
*/
|
|
256
|
-
function createConditionalExecutionFunction(func, conditionFunc) {
|
|
257
|
-
return function (...args) {
|
|
258
|
-
if (conditionFunc()) {
|
|
259
|
-
return func(...args);
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
265
|
-
/**
|
|
266
|
-
* Creates a wrapper function that silently ignores any errors thrown by the wrapped void function.
|
|
267
|
-
* This function is specifically for wrapping functions that do not return a value (void functions).
|
|
268
|
-
* Exceptions are swallowed without any logging or handling.
|
|
269
|
-
*
|
|
270
|
-
* @param func - The void function to be wrapped.
|
|
271
|
-
* @returns A wrapped version of the input function that ignores errors.
|
|
272
|
-
*/
|
|
273
|
-
function createErrorIgnoringFunction(func) {
|
|
274
|
-
return function (...args) {
|
|
275
|
-
try {
|
|
276
|
-
func(...args);
|
|
277
|
-
}
|
|
278
|
-
catch {
|
|
279
|
-
// Deliberately swallowing/ignoring the exception
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
285
|
-
/**
|
|
286
|
-
* A no-operation function (noop) that does nothing regardless of the arguments passed.
|
|
287
|
-
* It is designed to be as permissive as possible in its typing without using the `Function` keyword.
|
|
288
|
-
*
|
|
289
|
-
* @param args - Any arguments passed to the function (ignored)
|
|
290
|
-
*/
|
|
291
|
-
const noop = (...args) => {
|
|
292
|
-
// Intentionally does nothing
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
const logLevels = ['none', 'error', 'warn', 'log', 'info', 'debug'];
|
|
296
|
-
const priority = {
|
|
297
|
-
error: 4,
|
|
298
|
-
warn: 3,
|
|
299
|
-
log: 2,
|
|
300
|
-
info: 1,
|
|
301
|
-
debug: 0,
|
|
302
|
-
};
|
|
303
|
-
/**
|
|
304
|
-
* Validates whether a given string is a valid log level.
|
|
305
|
-
*
|
|
306
|
-
* @param level - The log level to validate
|
|
307
|
-
* @returns True if the level is valid, false otherwise
|
|
308
|
-
*/
|
|
309
|
-
function isValidLogLevel(level) {
|
|
310
|
-
return logLevels.includes(level);
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Creates a log level configuration manager for controlling logging behavior.
|
|
314
|
-
* Provides methods to get, set, and evaluate log levels based on priority.
|
|
315
|
-
*
|
|
316
|
-
* @param level - The initial log level (defaults to 'error')
|
|
317
|
-
* @returns A configuration object with log level management methods
|
|
318
|
-
* @throws {Error} When the provided level is not a valid log level
|
|
319
|
-
*/
|
|
320
|
-
function createLogLevelConfig(level = 'error') {
|
|
321
|
-
if (!isValidLogLevel(level)) {
|
|
322
|
-
throw createError('Cannot create log level configuration with a valid default log level');
|
|
323
|
-
}
|
|
324
|
-
const state = { level };
|
|
325
|
-
const getLogLevel = () => state.level;
|
|
326
|
-
const setLogLevel = (level) => {
|
|
327
|
-
if (!isValidLogLevel(level)) {
|
|
328
|
-
throw createError(`Cannot set value '${level}' level. Expected levels are ${logLevels}.`);
|
|
329
|
-
}
|
|
330
|
-
state.level = level;
|
|
331
|
-
};
|
|
332
|
-
const shouldLog = (level) => {
|
|
333
|
-
if (state.level === 'none' || level === 'none' || !isValidLogLevel(level)) {
|
|
334
|
-
return false;
|
|
335
|
-
}
|
|
336
|
-
return priority[level] >= priority[state.level];
|
|
337
|
-
};
|
|
338
|
-
return freeze({
|
|
339
|
-
getLogLevel,
|
|
340
|
-
setLogLevel,
|
|
341
|
-
shouldLog,
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* Creates a logger instance with configurable log level filtering.
|
|
347
|
-
* Each log function is wrapped to respect the current log level setting.
|
|
348
|
-
*
|
|
349
|
-
* @param error - Function to handle error-level logs (required)
|
|
350
|
-
* @param warn - Function to handle warning-level logs (optional, defaults to noop)
|
|
351
|
-
* @param log - Function to handle standard logs (optional, defaults to noop)
|
|
352
|
-
* @param info - Function to handle info-level logs (optional, defaults to noop)
|
|
353
|
-
* @param debug - Function to handle debug-level logs (optional, defaults to noop)
|
|
354
|
-
* @returns A frozen logger object with log methods and level control
|
|
355
|
-
* @throws {ErrorLevelFn} When any provided log function is invalid
|
|
356
|
-
*/
|
|
357
|
-
function createLogger(error, warn = noop, log = noop, info = noop, debug = noop) {
|
|
358
|
-
if (notValidLogFn(error)) {
|
|
359
|
-
throw createError(notFnMsg('error'));
|
|
360
|
-
}
|
|
361
|
-
if (notValidLogFn(warn)) {
|
|
362
|
-
throw createError(notFnMsg('warn'));
|
|
363
|
-
}
|
|
364
|
-
if (notValidLogFn(log)) {
|
|
365
|
-
throw createError(notFnMsg('log'));
|
|
366
|
-
}
|
|
367
|
-
if (notValidLogFn(info)) {
|
|
368
|
-
throw createError(notFnMsg('info'));
|
|
369
|
-
}
|
|
370
|
-
if (notValidLogFn(debug)) {
|
|
371
|
-
throw createError(notFnMsg('debug'));
|
|
372
|
-
}
|
|
373
|
-
const { setLogLevel, getLogLevel, shouldLog } = createLogLevelConfig();
|
|
374
|
-
const wrapLogFn = (fn, level) => {
|
|
375
|
-
if (fn === noop)
|
|
376
|
-
return fn;
|
|
377
|
-
const condition = () => shouldLog(level);
|
|
378
|
-
return createConditionalExecutionFunction(createErrorIgnoringFunction(fn), condition);
|
|
379
|
-
};
|
|
380
|
-
return freeze({
|
|
381
|
-
error: wrapLogFn(error, 'error'),
|
|
382
|
-
warn: wrapLogFn(warn, 'warn'),
|
|
383
|
-
log: wrapLogFn(log, 'log'),
|
|
384
|
-
info: wrapLogFn(info, 'info'),
|
|
385
|
-
debug: wrapLogFn(debug, 'debug'),
|
|
386
|
-
setLogLevel,
|
|
387
|
-
getLogLevel,
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Validates whether a given value is a valid log function.
|
|
392
|
-
*
|
|
393
|
-
* @param fn - The value to validate
|
|
394
|
-
* @returns True if the value is not a function (invalid), false if it is valid
|
|
395
|
-
*/
|
|
396
|
-
function notValidLogFn(fn) {
|
|
397
|
-
return getType(fn) !== 'function' && fn !== noop;
|
|
398
|
-
}
|
|
399
|
-
/**
|
|
400
|
-
* Generates an error message for invalid log function parameters.
|
|
401
|
-
*
|
|
402
|
-
* @param label - The name of the log function that failed validation
|
|
403
|
-
* @returns A formatted error message string
|
|
404
|
-
*/
|
|
405
|
-
function notFnMsg(label) {
|
|
406
|
-
return `Cannot create a logger when ${label} is not a function`;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
createLogger(error, warn, log, info, debug);
|
|
3
|
+
import { isArray } from '../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/array/index.esm.js';
|
|
4
|
+
import { error, warn, log, info, debug } from '../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/console/index.esm.js';
|
|
5
|
+
import { stringify, parse } from '../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/json/index.esm.js';
|
|
6
|
+
import { freeze, entries, keys, defineProperties, values } from '../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/object/index.esm.js';
|
|
7
|
+
import { createSet } from '../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.esm.js';
|
|
8
|
+
import { createLogger } from '../_dependencies/@hyperfrontend/logging/index.esm.js';
|
|
9
|
+
import { createError } from '../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.esm.js';
|
|
10
|
+
import { createMap } from '../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/map/index.esm.js';
|
|
11
|
+
import { isDirectory, exists } from '../_shared/core/fs/stat/index.esm.js';
|
|
12
|
+
import { join } from '../_shared/core/path/join/index.esm.js';
|
|
410
13
|
|
|
411
14
|
/**
|
|
412
15
|
* Global log level registry.
|
|
@@ -446,6 +49,13 @@ function isSensitiveKey(key) {
|
|
|
446
49
|
*
|
|
447
50
|
* @param obj - Object to sanitize
|
|
448
51
|
* @returns New object with sensitive values redacted
|
|
52
|
+
*
|
|
53
|
+
* @example Sanitizing sensitive data
|
|
54
|
+
* ```typescript
|
|
55
|
+
* const config = { apiKey: 'secret123', endpoint: 'https://api.example.com' }
|
|
56
|
+
* const safe = sanitize(config)
|
|
57
|
+
* // => { apiKey: '[REDACTED]', endpoint: 'https://api.example.com' }
|
|
58
|
+
* ```
|
|
449
59
|
*/
|
|
450
60
|
function sanitize(obj) {
|
|
451
61
|
if (obj === null || obj === undefined) {
|
|
@@ -496,7 +106,7 @@ function formatMessage(namespace, message, meta) {
|
|
|
496
106
|
* @param options - Logger configuration options
|
|
497
107
|
* @returns A configured scoped logger instance
|
|
498
108
|
*
|
|
499
|
-
* @example
|
|
109
|
+
* @example Creating a scoped logger
|
|
500
110
|
* ```typescript
|
|
501
111
|
* const logger = createScopedLogger('project-scope')
|
|
502
112
|
* logger.setLogLevel('debug')
|
|
@@ -511,14 +121,11 @@ function formatMessage(namespace, message, meta) {
|
|
|
511
121
|
*/
|
|
512
122
|
function createScopedLogger(namespace, options = {}) {
|
|
513
123
|
const { level = 'error', sanitizeSecrets = true } = options;
|
|
514
|
-
// Create wrapper functions that add namespace prefix and sanitization
|
|
515
124
|
const createLogFn = (baseFn) => (message, meta) => {
|
|
516
125
|
const processedMeta = sanitizeSecrets && meta ? sanitize(meta) : meta;
|
|
517
126
|
baseFn(formatMessage(namespace, message, processedMeta));
|
|
518
127
|
};
|
|
519
|
-
// Create base logger with wrapped functions
|
|
520
128
|
const baseLogger = createLogger(createLogFn(error), createLogFn(warn), createLogFn(log), createLogFn(info), createLogFn(debug));
|
|
521
|
-
// Set initial log level (use global override if set)
|
|
522
129
|
baseLogger.setLogLevel(level);
|
|
523
130
|
const scopedLogger = freeze({
|
|
524
131
|
error: (message, meta) => baseLogger.error(message, meta),
|
|
@@ -529,7 +136,6 @@ function createScopedLogger(namespace, options = {}) {
|
|
|
529
136
|
setLogLevel: baseLogger.setLogLevel,
|
|
530
137
|
getLogLevel: baseLogger.getLogLevel,
|
|
531
138
|
});
|
|
532
|
-
// Register logger for global level management
|
|
533
139
|
loggerRegistry.add(scopedLogger);
|
|
534
140
|
return scopedLogger;
|
|
535
141
|
}
|
|
@@ -537,7 +143,7 @@ function createScopedLogger(namespace, options = {}) {
|
|
|
537
143
|
* Default logger instance for the project-scope library.
|
|
538
144
|
* Use this for general logging within the library.
|
|
539
145
|
*
|
|
540
|
-
* @example
|
|
146
|
+
* @example Using the default logger
|
|
541
147
|
* ```typescript
|
|
542
148
|
* import { logger } from '@hyperfrontend/project-scope/core'
|
|
543
149
|
*
|
|
@@ -555,6 +161,15 @@ createScopedLogger('project-scope:fs');
|
|
|
555
161
|
* @param code - The category code for this type of filesystem failure
|
|
556
162
|
* @param context - Additional context including path, operation, and cause
|
|
557
163
|
* @returns A configured Error object with code and context properties
|
|
164
|
+
*
|
|
165
|
+
* @example Creating a file system error
|
|
166
|
+
* ```typescript
|
|
167
|
+
* throw createFileSystemError(
|
|
168
|
+
* 'Cannot read file',
|
|
169
|
+
* 'FS_READ_ERROR',
|
|
170
|
+
* { path: './missing.txt', operation: 'read' }
|
|
171
|
+
* )
|
|
172
|
+
* ```
|
|
558
173
|
*/
|
|
559
174
|
function createFileSystemError(message, code, context) {
|
|
560
175
|
const error = createError(message);
|
|
@@ -570,6 +185,14 @@ function createFileSystemError(message, code, context) {
|
|
|
570
185
|
* @param filePath - Path to file
|
|
571
186
|
* @param encoding - File encoding (default: utf-8)
|
|
572
187
|
* @returns File contents or null if file doesn't exist
|
|
188
|
+
*
|
|
189
|
+
* @example Reading file if it exists
|
|
190
|
+
* ```typescript
|
|
191
|
+
* const content = readFileIfExists('./optional-config.json')
|
|
192
|
+
* if (content) {
|
|
193
|
+
* // File existed, use content
|
|
194
|
+
* }
|
|
195
|
+
* ```
|
|
573
196
|
*/
|
|
574
197
|
function readFileIfExists(filePath, encoding = 'utf-8') {
|
|
575
198
|
if (!existsSync(filePath)) {
|
|
@@ -587,6 +210,13 @@ function readFileIfExists(filePath, encoding = 'utf-8') {
|
|
|
587
210
|
*
|
|
588
211
|
* @param filePath - Path to JSON file
|
|
589
212
|
* @returns Parsed JSON object or null if file doesn't exist or is invalid
|
|
213
|
+
*
|
|
214
|
+
* @example Reading JSON file if it exists
|
|
215
|
+
* ```typescript
|
|
216
|
+
* interface UserSettings { theme: string }
|
|
217
|
+
* const settings = readJsonFileIfExists<UserSettings>('./user-settings.json')
|
|
218
|
+
* const theme = settings?.theme ?? 'default'
|
|
219
|
+
* ```
|
|
590
220
|
*/
|
|
591
221
|
function readJsonFileIfExists(filePath) {
|
|
592
222
|
if (!existsSync(filePath)) {
|
|
@@ -601,56 +231,6 @@ function readJsonFileIfExists(filePath) {
|
|
|
601
231
|
}
|
|
602
232
|
}
|
|
603
233
|
|
|
604
|
-
createScopedLogger('project-scope:fs:write');
|
|
605
|
-
|
|
606
|
-
/**
|
|
607
|
-
* Get file stats with error handling.
|
|
608
|
-
*
|
|
609
|
-
* @param filePath - Path to file
|
|
610
|
-
* @param followSymlinks - Whether to follow symlinks (default: true)
|
|
611
|
-
* @returns File stats or null if path doesn't exist
|
|
612
|
-
*/
|
|
613
|
-
function getFileStat(filePath, followSymlinks = true) {
|
|
614
|
-
if (!existsSync(filePath)) {
|
|
615
|
-
return null;
|
|
616
|
-
}
|
|
617
|
-
try {
|
|
618
|
-
const stat = followSymlinks ? statSync(filePath) : lstatSync(filePath);
|
|
619
|
-
return {
|
|
620
|
-
isFile: stat.isFile(),
|
|
621
|
-
isDirectory: stat.isDirectory(),
|
|
622
|
-
isSymlink: stat.isSymbolicLink(),
|
|
623
|
-
size: stat.size,
|
|
624
|
-
created: stat.birthtime,
|
|
625
|
-
modified: stat.mtime,
|
|
626
|
-
accessed: stat.atime,
|
|
627
|
-
mode: stat.mode,
|
|
628
|
-
};
|
|
629
|
-
}
|
|
630
|
-
catch {
|
|
631
|
-
return null;
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
/**
|
|
635
|
-
* Check if path is a directory.
|
|
636
|
-
*
|
|
637
|
-
* @param dirPath - Path to check
|
|
638
|
-
* @returns True if path is a directory
|
|
639
|
-
*/
|
|
640
|
-
function isDirectory(dirPath) {
|
|
641
|
-
const stats = getFileStat(dirPath);
|
|
642
|
-
return stats?.isDirectory ?? false;
|
|
643
|
-
}
|
|
644
|
-
/**
|
|
645
|
-
* Check if path exists.
|
|
646
|
-
*
|
|
647
|
-
* @param filePath - Path to check
|
|
648
|
-
* @returns True if path exists
|
|
649
|
-
*/
|
|
650
|
-
function exists(filePath) {
|
|
651
|
-
return existsSync(filePath);
|
|
652
|
-
}
|
|
653
|
-
|
|
654
234
|
const fsDirLogger = createScopedLogger('project-scope:fs:dir');
|
|
655
235
|
/**
|
|
656
236
|
* List immediate contents of a directory.
|
|
@@ -659,7 +239,7 @@ const fsDirLogger = createScopedLogger('project-scope:fs:dir');
|
|
|
659
239
|
* @returns Array of entries with metadata for each file/directory
|
|
660
240
|
* @throws {Error} If directory doesn't exist or isn't a directory
|
|
661
241
|
*
|
|
662
|
-
* @example
|
|
242
|
+
* @example Listing directory contents
|
|
663
243
|
* ```typescript
|
|
664
244
|
* import { readDirectory } from '@hyperfrontend/project-scope'
|
|
665
245
|
*
|
|
@@ -700,17 +280,6 @@ function readDirectory(dirPath) {
|
|
|
700
280
|
}
|
|
701
281
|
}
|
|
702
282
|
|
|
703
|
-
/**
|
|
704
|
-
* Join path segments.
|
|
705
|
-
* Uses platform-specific separators (e.g., / or \).
|
|
706
|
-
*
|
|
707
|
-
* @param paths - Path segments to join
|
|
708
|
-
* @returns Joined path
|
|
709
|
-
*/
|
|
710
|
-
function join(...paths) {
|
|
711
|
-
return join$1(...paths);
|
|
712
|
-
}
|
|
713
|
-
|
|
714
283
|
const fsTraversalLogger = createScopedLogger('project-scope:fs:traversal');
|
|
715
284
|
/**
|
|
716
285
|
* Generic upward directory traversal.
|
|
@@ -719,6 +288,15 @@ const fsTraversalLogger = createScopedLogger('project-scope:fs:traversal');
|
|
|
719
288
|
* @param startPath - Starting directory
|
|
720
289
|
* @param predicate - Function to test each directory
|
|
721
290
|
* @returns First matching directory or null
|
|
291
|
+
*
|
|
292
|
+
* @example Finding directory containing README
|
|
293
|
+
* ```typescript
|
|
294
|
+
* // Find first directory containing a README
|
|
295
|
+
* const readmeDir = traverseUpward('./src/utils', (dir) =>
|
|
296
|
+
* existsSync(join(dir, 'README.md'))
|
|
297
|
+
* )
|
|
298
|
+
* // => '/project' or null
|
|
299
|
+
* ```
|
|
722
300
|
*/
|
|
723
301
|
function traverseUpward(startPath, predicate) {
|
|
724
302
|
fsTraversalLogger.debug('Starting upward traversal', { startPath });
|
|
@@ -731,7 +309,6 @@ function traverseUpward(startPath, predicate) {
|
|
|
731
309
|
}
|
|
732
310
|
currentPath = dirname(currentPath);
|
|
733
311
|
}
|
|
734
|
-
// Check root directory
|
|
735
312
|
if (predicate(rootPath)) {
|
|
736
313
|
fsTraversalLogger.debug('Upward traversal found match at root', { startPath, foundPath: rootPath });
|
|
737
314
|
return rootPath;
|
|
@@ -745,6 +322,17 @@ function traverseUpward(startPath, predicate) {
|
|
|
745
322
|
* @param startPath - Starting directory
|
|
746
323
|
* @param markers - Array of marker file names to search for
|
|
747
324
|
* @returns First directory containing any marker, or null
|
|
325
|
+
*
|
|
326
|
+
* @example Finding project root by marker files
|
|
327
|
+
* ```typescript
|
|
328
|
+
* // Find project root by looking for common marker files
|
|
329
|
+
* const projectRoot = locateByMarkers('./src/components', [
|
|
330
|
+
* 'package.json',
|
|
331
|
+
* 'nx.json',
|
|
332
|
+
* 'tsconfig.base.json'
|
|
333
|
+
* ])
|
|
334
|
+
* // => '/workspace/my-project'
|
|
335
|
+
* ```
|
|
748
336
|
*/
|
|
749
337
|
function locateByMarkers(startPath, markers) {
|
|
750
338
|
fsTraversalLogger.debug('Locating by markers', { startPath, markers });
|
|
@@ -755,6 +343,8 @@ function locateByMarkers(startPath, markers) {
|
|
|
755
343
|
return result;
|
|
756
344
|
}
|
|
757
345
|
|
|
346
|
+
createScopedLogger('project-scope:fs:write');
|
|
347
|
+
|
|
758
348
|
const packageLogger = createScopedLogger('project-scope:project:package');
|
|
759
349
|
/**
|
|
760
350
|
* Verifies that a value is an object with only string values,
|
|
@@ -824,6 +414,16 @@ function validatePackageJson(data) {
|
|
|
824
414
|
*
|
|
825
415
|
* @param projectPath - Project directory path or path to package.json
|
|
826
416
|
* @returns Parsed package.json or null if not found
|
|
417
|
+
*
|
|
418
|
+
* @example Reading package.json if it exists
|
|
419
|
+
* ```typescript
|
|
420
|
+
* import { readPackageJsonIfExists } from '@hyperfrontend/project-scope'
|
|
421
|
+
*
|
|
422
|
+
* const pkg = readPackageJsonIfExists('/path/to/project')
|
|
423
|
+
* if (pkg) {
|
|
424
|
+
* console.log('Found:', pkg.name)
|
|
425
|
+
* }
|
|
426
|
+
* ```
|
|
827
427
|
*/
|
|
828
428
|
function readPackageJsonIfExists(projectPath) {
|
|
829
429
|
const packageJsonPath = projectPath.endsWith('package.json') ? projectPath : join$1(projectPath, 'package.json');
|
|
@@ -850,6 +450,15 @@ createScopedLogger('project-scope:root');
|
|
|
850
450
|
* @param startPath - Starting path
|
|
851
451
|
* @param markers - Files to search for
|
|
852
452
|
* @returns Root directory path or null
|
|
453
|
+
*
|
|
454
|
+
* @example Finding root by marker files
|
|
455
|
+
* ```typescript
|
|
456
|
+
* import { findRootDirectory } from '@hyperfrontend/project-scope'
|
|
457
|
+
*
|
|
458
|
+
* // Find monorepo root by looking for nx.json or lerna.json
|
|
459
|
+
* const root = findRootDirectory('./libs/my-lib', ['nx.json', 'lerna.json'])
|
|
460
|
+
* // => '/path/to/monorepo'
|
|
461
|
+
* ```
|
|
853
462
|
*/
|
|
854
463
|
function findRootDirectory(startPath, markers) {
|
|
855
464
|
return locateByMarkers(startPath, markers);
|
|
@@ -870,7 +479,7 @@ const NX_PROJECT_FILE = 'project.json';
|
|
|
870
479
|
* @param path - Directory path to check
|
|
871
480
|
* @returns True if the directory contains nx.json or workspace.json
|
|
872
481
|
*
|
|
873
|
-
* @example
|
|
482
|
+
* @example Checking for NX workspace
|
|
874
483
|
* ```typescript
|
|
875
484
|
* import { isNxWorkspace } from '@hyperfrontend/project-scope'
|
|
876
485
|
*
|
|
@@ -894,6 +503,15 @@ function isNxWorkspace(path) {
|
|
|
894
503
|
*
|
|
895
504
|
* @param path - Directory path to check
|
|
896
505
|
* @returns True if the directory contains project.json
|
|
506
|
+
*
|
|
507
|
+
* @example Checking for NX project
|
|
508
|
+
* ```typescript
|
|
509
|
+
* import { isNxProject } from '@hyperfrontend/project-scope'
|
|
510
|
+
*
|
|
511
|
+
* if (isNxProject('./libs/my-lib')) {
|
|
512
|
+
* console.log('This is an NX project')
|
|
513
|
+
* }
|
|
514
|
+
* ```
|
|
897
515
|
*/
|
|
898
516
|
function isNxProject(path) {
|
|
899
517
|
const isProject = exists(join$1(path, NX_PROJECT_FILE));
|
|
@@ -906,7 +524,7 @@ function isNxProject(path) {
|
|
|
906
524
|
* @param startPath - Starting path to search from
|
|
907
525
|
* @returns Workspace root path or null if not found
|
|
908
526
|
*
|
|
909
|
-
* @example
|
|
527
|
+
* @example Finding NX workspace root
|
|
910
528
|
* ```typescript
|
|
911
529
|
* import { findNxWorkspaceRoot } from '@hyperfrontend/project-scope'
|
|
912
530
|
*
|
|
@@ -938,7 +556,6 @@ function detectNxVersion(workspacePath) {
|
|
|
938
556
|
if (packageJson) {
|
|
939
557
|
const nxVersion = packageJson.devDependencies?.['nx'] ?? packageJson.dependencies?.['nx'];
|
|
940
558
|
if (nxVersion) {
|
|
941
|
-
// Strip semver range characters (^, ~, >=, etc.)
|
|
942
559
|
return nxVersion.replace(/^[\^~>=<]+/, '');
|
|
943
560
|
}
|
|
944
561
|
}
|
|
@@ -959,6 +576,17 @@ function isIntegratedRepo(nxJson) {
|
|
|
959
576
|
*
|
|
960
577
|
* @param workspacePath - Workspace root path
|
|
961
578
|
* @returns Workspace info or null if not an NX workspace
|
|
579
|
+
*
|
|
580
|
+
* @example Getting NX workspace information
|
|
581
|
+
* ```typescript
|
|
582
|
+
* import { getNxWorkspaceInfo } from '@hyperfrontend/project-scope'
|
|
583
|
+
*
|
|
584
|
+
* const info = getNxWorkspaceInfo('/path/to/monorepo')
|
|
585
|
+
* if (info) {
|
|
586
|
+
* console.log('NX version:', info.version)
|
|
587
|
+
* console.log('Apps dir:', info.workspaceLayout.appsDir)
|
|
588
|
+
* }
|
|
589
|
+
* ```
|
|
962
590
|
*/
|
|
963
591
|
function getNxWorkspaceInfo(workspacePath) {
|
|
964
592
|
nxLogger.debug('Getting NX workspace info', { workspacePath });
|
|
@@ -967,14 +595,12 @@ function getNxWorkspaceInfo(workspacePath) {
|
|
|
967
595
|
}
|
|
968
596
|
const nxJson = readJsonFileIfExists(join$1(workspacePath, 'nx.json'));
|
|
969
597
|
if (!nxJson) {
|
|
970
|
-
// Check for workspace.json as fallback (older NX)
|
|
971
598
|
const workspaceJson = readJsonFileIfExists(join$1(workspacePath, 'workspace.json'));
|
|
972
599
|
if (!workspaceJson) {
|
|
973
600
|
nxLogger.debug('No nx.json or workspace.json found', { workspacePath });
|
|
974
601
|
return null;
|
|
975
602
|
}
|
|
976
603
|
nxLogger.debug('Using legacy workspace.json', { workspacePath });
|
|
977
|
-
// Create minimal nx.json from workspace.json
|
|
978
604
|
return {
|
|
979
605
|
root: workspacePath,
|
|
980
606
|
version: detectNxVersion(workspacePath),
|
|
@@ -1006,98 +632,22 @@ function getNxWorkspaceInfo(workspacePath) {
|
|
|
1006
632
|
return info;
|
|
1007
633
|
}
|
|
1008
634
|
|
|
1009
|
-
const devkitLogger = createScopedLogger('project-scope:nx:devkit');
|
|
1010
|
-
/** Cached load result to avoid repeated require attempts */
|
|
1011
|
-
let cachedResult = null;
|
|
1012
|
-
/**
|
|
1013
|
-
* Try to load `@nx/devkit` at runtime.
|
|
1014
|
-
* Uses dynamic require to avoid bundling `@nx/devkit` into our output.
|
|
1015
|
-
* Results are cached for subsequent calls.
|
|
1016
|
-
*
|
|
1017
|
-
* @returns DevkitLoadResult with availability status and devkit module or error
|
|
1018
|
-
*/
|
|
1019
|
-
function tryLoadDevkit() {
|
|
1020
|
-
if (cachedResult !== null) {
|
|
1021
|
-
devkitLogger.debug('Returning cached devkit result', { available: cachedResult.available });
|
|
1022
|
-
return cachedResult;
|
|
1023
|
-
}
|
|
1024
|
-
devkitLogger.debug('Attempting to load @nx/devkit');
|
|
1025
|
-
try {
|
|
1026
|
-
// Dynamic require to avoid bundling
|
|
1027
|
-
const devkit = require('@nx/devkit');
|
|
1028
|
-
devkitLogger.debug('@nx/devkit loaded successfully');
|
|
1029
|
-
cachedResult = { available: true, devkit };
|
|
1030
|
-
}
|
|
1031
|
-
catch (error) {
|
|
1032
|
-
devkitLogger.debug('@nx/devkit not available', { error: error instanceof Error ? error.message : String(error) });
|
|
1033
|
-
cachedResult = {
|
|
1034
|
-
available: false,
|
|
1035
|
-
error: error instanceof Error ? error : createError(String(error)),
|
|
1036
|
-
};
|
|
1037
|
-
}
|
|
1038
|
-
return cachedResult;
|
|
1039
|
-
}
|
|
1040
|
-
/**
|
|
1041
|
-
* Check if `@nx/devkit` is available.
|
|
1042
|
-
*
|
|
1043
|
-
* @returns true if devkit can be loaded, false otherwise
|
|
1044
|
-
*/
|
|
1045
|
-
function isDevkitAvailable() {
|
|
1046
|
-
return tryLoadDevkit().available;
|
|
1047
|
-
}
|
|
1048
|
-
/**
|
|
1049
|
-
* Get `@nx/devkit` module if available.
|
|
1050
|
-
* Throws if not available.
|
|
1051
|
-
*
|
|
1052
|
-
* @returns The `@nx/devkit` module with full type information
|
|
1053
|
-
* @throws {Error} If `@nx/devkit` is not available
|
|
1054
|
-
*/
|
|
1055
|
-
function getDevkit() {
|
|
1056
|
-
const result = tryLoadDevkit();
|
|
1057
|
-
if (!result.available) {
|
|
1058
|
-
throw createError('@nx/devkit is not available. Install it as a dependency or use standalone mode.');
|
|
1059
|
-
}
|
|
1060
|
-
return result.devkit;
|
|
1061
|
-
}
|
|
1062
|
-
/**
|
|
1063
|
-
* Execute function with `@nx/devkit` if available, otherwise execute fallback.
|
|
1064
|
-
* This pattern allows graceful degradation when `@nx/devkit` is not installed.
|
|
1065
|
-
*
|
|
1066
|
-
* @param ifAvailable - Function to execute if `@nx/devkit` is available
|
|
1067
|
-
* @param fallback - Function to execute if `@nx/devkit` is not available
|
|
1068
|
-
* @returns Result from whichever function was executed
|
|
1069
|
-
*
|
|
1070
|
-
* @example
|
|
1071
|
-
* ```typescript
|
|
1072
|
-
* const tree = withDevkit(
|
|
1073
|
-
* (devkit) => devkit.createTree(),
|
|
1074
|
-
* () => new FsTree(process.cwd())
|
|
1075
|
-
* )
|
|
1076
|
-
* ```
|
|
1077
|
-
*/
|
|
1078
|
-
function withDevkit(ifAvailable, fallback) {
|
|
1079
|
-
const result = tryLoadDevkit();
|
|
1080
|
-
if (result.available && result.devkit) {
|
|
1081
|
-
return ifAvailable(result.devkit);
|
|
1082
|
-
}
|
|
1083
|
-
return fallback();
|
|
1084
|
-
}
|
|
1085
|
-
/**
|
|
1086
|
-
* Reset the cached devkit load result.
|
|
1087
|
-
* Primarily useful for testing.
|
|
1088
|
-
*
|
|
1089
|
-
* @internal
|
|
1090
|
-
*/
|
|
1091
|
-
function resetDevkitCache() {
|
|
1092
|
-
cachedResult = null;
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
635
|
const nxConfigLogger = createScopedLogger('project-scope:nx:config');
|
|
1096
636
|
/**
|
|
1097
637
|
* Read project.json for an NX project.
|
|
1098
638
|
*
|
|
1099
639
|
* @param projectPath - Project directory path
|
|
1100
640
|
* @returns Parsed project.json or null if not found
|
|
641
|
+
*
|
|
642
|
+
* @example Reading NX project.json
|
|
643
|
+
* ```typescript
|
|
644
|
+
* import { readProjectJson } from '@hyperfrontend/project-scope'
|
|
645
|
+
*
|
|
646
|
+
* const config = readProjectJson('./libs/my-lib')
|
|
647
|
+
* if (config) {
|
|
648
|
+
* console.log('Project:', config.name, 'Type:', config.projectType)
|
|
649
|
+
* }
|
|
650
|
+
* ```
|
|
1101
651
|
*/
|
|
1102
652
|
function readProjectJson(projectPath) {
|
|
1103
653
|
const projectJsonPath = join$1(projectPath, NX_PROJECT_FILE);
|
|
@@ -1117,10 +667,17 @@ function readProjectJson(projectPath) {
|
|
|
1117
667
|
* @param projectPath - Project directory path
|
|
1118
668
|
* @param workspacePath - Workspace root path (for relative path calculation)
|
|
1119
669
|
* @returns Project configuration or null if not found
|
|
670
|
+
*
|
|
671
|
+
* @example Getting project configuration
|
|
672
|
+
* ```typescript
|
|
673
|
+
* import { getProjectConfig } from '@hyperfrontend/project-scope'
|
|
674
|
+
*
|
|
675
|
+
* const config = getProjectConfig('./libs/my-lib', '/workspace')
|
|
676
|
+
* // => { name: 'my-lib', root: 'libs/my-lib', projectType: 'library' }
|
|
677
|
+
* ```
|
|
1120
678
|
*/
|
|
1121
679
|
function getProjectConfig(projectPath, workspacePath) {
|
|
1122
680
|
nxConfigLogger.debug('Getting project config', { projectPath, workspacePath });
|
|
1123
|
-
// Try project.json first
|
|
1124
681
|
const projectJson = readProjectJson(projectPath);
|
|
1125
682
|
if (projectJson) {
|
|
1126
683
|
nxConfigLogger.debug('Using project.json config', { projectPath, name: projectJson.name });
|
|
@@ -1129,7 +686,6 @@ function getProjectConfig(projectPath, workspacePath) {
|
|
|
1129
686
|
root: projectJson.root ?? relative(workspacePath, projectPath),
|
|
1130
687
|
};
|
|
1131
688
|
}
|
|
1132
|
-
// Try to infer from package.json nx field
|
|
1133
689
|
const packageJson = readPackageJsonIfExists(projectPath);
|
|
1134
690
|
if (packageJson && typeof packageJson['nx'] === 'object') {
|
|
1135
691
|
nxConfigLogger.debug('Using package.json nx field', { projectPath, name: packageJson.name });
|
|
@@ -1158,13 +714,11 @@ function scanForProjects(dirPath, workspacePath, projects, maxDepth, currentDept
|
|
|
1158
714
|
try {
|
|
1159
715
|
const entries = readDirectory(dirPath);
|
|
1160
716
|
for (const entry of entries) {
|
|
1161
|
-
// Skip node_modules and hidden directories
|
|
1162
717
|
if (entry.name.startsWith('.') || entry.name === 'node_modules' || entry.name === 'dist') {
|
|
1163
718
|
continue;
|
|
1164
719
|
}
|
|
1165
720
|
const fullPath = join$1(dirPath, entry.name);
|
|
1166
721
|
if (entry.isDirectory) {
|
|
1167
|
-
// Check if this directory is an NX project
|
|
1168
722
|
if (isNxProject(fullPath)) {
|
|
1169
723
|
const config = getProjectConfig(fullPath, workspacePath);
|
|
1170
724
|
if (config) {
|
|
@@ -1176,7 +730,6 @@ function scanForProjects(dirPath, workspacePath, projects, maxDepth, currentDept
|
|
|
1176
730
|
});
|
|
1177
731
|
}
|
|
1178
732
|
}
|
|
1179
|
-
// Recursively scan subdirectories
|
|
1180
733
|
scanForProjects(fullPath, workspacePath, projects, maxDepth, currentDepth + 1);
|
|
1181
734
|
}
|
|
1182
735
|
}
|
|
@@ -1191,15 +744,23 @@ function scanForProjects(dirPath, workspacePath, projects, maxDepth, currentDept
|
|
|
1191
744
|
*
|
|
1192
745
|
* @param workspacePath - Workspace root path
|
|
1193
746
|
* @returns Map of project name to configuration
|
|
747
|
+
*
|
|
748
|
+
* @example Discovering all NX projects
|
|
749
|
+
* ```typescript
|
|
750
|
+
* import { discoverNxProjects } from '@hyperfrontend/project-scope'
|
|
751
|
+
*
|
|
752
|
+
* const projects = discoverNxProjects('/workspace')
|
|
753
|
+
* for (const [name, config] of projects) {
|
|
754
|
+
* console.log(`${name}: ${config.projectType} at ${config.root}`)
|
|
755
|
+
* }
|
|
756
|
+
* ```
|
|
1194
757
|
*/
|
|
1195
758
|
function discoverNxProjects(workspacePath) {
|
|
1196
759
|
const projects = createMap();
|
|
1197
|
-
// Check for workspace.json (older NX format)
|
|
1198
760
|
const workspaceJson = readJsonFileIfExists(join$1(workspacePath, 'workspace.json'));
|
|
1199
761
|
if (workspaceJson?.projects) {
|
|
1200
762
|
for (const [name, config] of entries(workspaceJson.projects)) {
|
|
1201
763
|
if (typeof config === 'string') {
|
|
1202
|
-
// Path reference to project directory
|
|
1203
764
|
const projectPath = join$1(workspacePath, config);
|
|
1204
765
|
const projectConfig = getProjectConfig(projectPath, workspacePath);
|
|
1205
766
|
if (projectConfig) {
|
|
@@ -1207,18 +768,15 @@ function discoverNxProjects(workspacePath) {
|
|
|
1207
768
|
}
|
|
1208
769
|
}
|
|
1209
770
|
else if (typeof config === 'object' && config !== null) {
|
|
1210
|
-
// Inline config
|
|
1211
771
|
projects.set(name, { name, ...config });
|
|
1212
772
|
}
|
|
1213
773
|
}
|
|
1214
774
|
return projects;
|
|
1215
775
|
}
|
|
1216
|
-
// Scan for project.json files (newer NX format)
|
|
1217
776
|
const workspaceInfo = getNxWorkspaceInfo(workspacePath);
|
|
1218
777
|
const appsDir = workspaceInfo?.workspaceLayout.appsDir ?? 'apps';
|
|
1219
778
|
const libsDir = workspaceInfo?.workspaceLayout.libsDir ?? 'libs';
|
|
1220
779
|
const searchDirs = [appsDir, libsDir];
|
|
1221
|
-
// Also check packages directory (common in some setups)
|
|
1222
780
|
if (exists(join$1(workspacePath, 'packages'))) {
|
|
1223
781
|
searchDirs.push('packages');
|
|
1224
782
|
}
|
|
@@ -1233,7 +791,6 @@ function discoverNxProjects(workspacePath) {
|
|
|
1233
791
|
}
|
|
1234
792
|
}
|
|
1235
793
|
}
|
|
1236
|
-
// Also check root-level projects (standalone projects in monorepo root)
|
|
1237
794
|
if (isNxProject(workspacePath)) {
|
|
1238
795
|
const config = readProjectJson(workspacePath);
|
|
1239
796
|
if (config) {
|
|
@@ -1249,11 +806,19 @@ function discoverNxProjects(workspacePath) {
|
|
|
1249
806
|
}
|
|
1250
807
|
/**
|
|
1251
808
|
* Build a simple project graph from discovered projects.
|
|
1252
|
-
* For full graph capabilities, use `@nx/devkit`.
|
|
1253
809
|
*
|
|
1254
810
|
* @param workspacePath - Workspace root path
|
|
1255
811
|
* @param projects - Existing configuration map to skip auto-discovery
|
|
1256
812
|
* @returns NxProjectGraph with nodes and dependencies
|
|
813
|
+
*
|
|
814
|
+
* @example Building a simple project graph
|
|
815
|
+
* ```typescript
|
|
816
|
+
* import { buildSimpleProjectGraph } from '@hyperfrontend/project-scope'
|
|
817
|
+
*
|
|
818
|
+
* const graph = buildSimpleProjectGraph('/workspace')
|
|
819
|
+
* console.log('Projects:', Object.keys(graph.nodes))
|
|
820
|
+
* console.log('Dependencies:', graph.dependencies['my-app'])
|
|
821
|
+
* ```
|
|
1257
822
|
*/
|
|
1258
823
|
function buildSimpleProjectGraph(workspacePath, projects) {
|
|
1259
824
|
const projectMap = projects ?? discoverNxProjects(workspacePath);
|
|
@@ -1266,10 +831,8 @@ function buildSimpleProjectGraph(workspacePath, projects) {
|
|
|
1266
831
|
data: config,
|
|
1267
832
|
};
|
|
1268
833
|
dependencies[name] = [];
|
|
1269
|
-
// Add implicit dependencies
|
|
1270
834
|
if (config.implicitDependencies) {
|
|
1271
835
|
for (const dep of config.implicitDependencies) {
|
|
1272
|
-
// Skip negative dependencies (those starting with !)
|
|
1273
836
|
if (!dep.startsWith('!')) {
|
|
1274
837
|
dependencies[name].push({
|
|
1275
838
|
target: dep,
|
|
@@ -1282,5 +845,4 @@ function buildSimpleProjectGraph(workspacePath, projects) {
|
|
|
1282
845
|
return { nodes, dependencies };
|
|
1283
846
|
}
|
|
1284
847
|
|
|
1285
|
-
export { NX_CONFIG_FILES, NX_PROJECT_FILE, buildSimpleProjectGraph, discoverNxProjects, findNxWorkspaceRoot,
|
|
1286
|
-
//# sourceMappingURL=index.esm.js.map
|
|
848
|
+
export { NX_CONFIG_FILES, NX_PROJECT_FILE, buildSimpleProjectGraph, discoverNxProjects, findNxWorkspaceRoot, getNxWorkspaceInfo, getProjectConfig, isNxProject, isNxWorkspace, readProjectJson };
|