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