@hyperfrontend/project-scope 0.1.0
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/ARCHITECTURE.md +370 -0
- package/CHANGELOG.md +10 -0
- package/FUNDING.md +141 -0
- package/LICENSE.md +21 -0
- package/README.md +242 -0
- package/SECURITY.md +82 -0
- package/analyze.d.ts +33 -0
- package/analyze.d.ts.map +1 -0
- package/cli/commands/analyze.d.ts +20 -0
- package/cli/commands/analyze.d.ts.map +1 -0
- package/cli/commands/config.d.ts +20 -0
- package/cli/commands/config.d.ts.map +1 -0
- package/cli/commands/deps.d.ts +18 -0
- package/cli/commands/deps.d.ts.map +1 -0
- package/cli/commands/tree.d.ts +24 -0
- package/cli/commands/tree.d.ts.map +1 -0
- package/cli/index.cjs.js +6639 -0
- package/cli/index.cjs.js.map +1 -0
- package/cli/index.d.ts +7 -0
- package/cli/index.d.ts.map +1 -0
- package/cli/index.esm.js +6629 -0
- package/cli/index.esm.js.map +1 -0
- package/cli/run.d.ts +25 -0
- package/cli/run.d.ts.map +1 -0
- package/cli/types.d.ts +55 -0
- package/cli/types.d.ts.map +1 -0
- package/core/cache.d.ts +157 -0
- package/core/cache.d.ts.map +1 -0
- package/core/encoding/convert.d.ts +32 -0
- package/core/encoding/convert.d.ts.map +1 -0
- package/core/encoding/detect.d.ts +86 -0
- package/core/encoding/detect.d.ts.map +1 -0
- package/core/encoding/index.cjs.js +751 -0
- package/core/encoding/index.cjs.js.map +1 -0
- package/core/encoding/index.d.ts +3 -0
- package/core/encoding/index.d.ts.map +1 -0
- package/core/encoding/index.esm.js +736 -0
- package/core/encoding/index.esm.js.map +1 -0
- package/core/errors/structured-errors.d.ts +64 -0
- package/core/errors/structured-errors.d.ts.map +1 -0
- package/core/fs/directory.d.ts +88 -0
- package/core/fs/directory.d.ts.map +1 -0
- package/core/fs/index.cjs.js +1079 -0
- package/core/fs/index.cjs.js.map +1 -0
- package/core/fs/index.d.ts +6 -0
- package/core/fs/index.d.ts.map +1 -0
- package/core/fs/index.esm.js +1056 -0
- package/core/fs/index.esm.js.map +1 -0
- package/core/fs/read.d.ts +86 -0
- package/core/fs/read.d.ts.map +1 -0
- package/core/fs/stat.d.ts +58 -0
- package/core/fs/stat.d.ts.map +1 -0
- package/core/fs/traversal.d.ts +26 -0
- package/core/fs/traversal.d.ts.map +1 -0
- package/core/fs/write.d.ts +75 -0
- package/core/fs/write.d.ts.map +1 -0
- package/core/index.cjs.js +2376 -0
- package/core/index.cjs.js.map +1 -0
- package/core/index.d.ts +9 -0
- package/core/index.d.ts.map +1 -0
- package/core/index.esm.js +2286 -0
- package/core/index.esm.js.map +1 -0
- package/core/logger.d.ts +111 -0
- package/core/logger.d.ts.map +1 -0
- package/core/path/index.cjs.js +254 -0
- package/core/path/index.cjs.js.map +1 -0
- package/core/path/index.d.ts +5 -0
- package/core/path/index.d.ts.map +1 -0
- package/core/path/index.esm.js +233 -0
- package/core/path/index.esm.js.map +1 -0
- package/core/path/join.d.ts +17 -0
- package/core/path/join.d.ts.map +1 -0
- package/core/path/normalize.d.ts +37 -0
- package/core/path/normalize.d.ts.map +1 -0
- package/core/path/resolve.d.ts +52 -0
- package/core/path/resolve.d.ts.map +1 -0
- package/core/path/segments.d.ts +59 -0
- package/core/path/segments.d.ts.map +1 -0
- package/core/patterns/glob.d.ts +46 -0
- package/core/patterns/glob.d.ts.map +1 -0
- package/core/platform/detect.d.ts +66 -0
- package/core/platform/detect.d.ts.map +1 -0
- package/core/platform/index.cjs.js +241 -0
- package/core/platform/index.cjs.js.map +1 -0
- package/core/platform/index.d.ts +3 -0
- package/core/platform/index.d.ts.map +1 -0
- package/core/platform/index.esm.js +226 -0
- package/core/platform/index.esm.js.map +1 -0
- package/core/platform/line-endings.d.ts +48 -0
- package/core/platform/line-endings.d.ts.map +1 -0
- package/heuristics/dependencies/analyze.d.ts +77 -0
- package/heuristics/dependencies/analyze.d.ts.map +1 -0
- package/heuristics/dependencies/index.cjs.js +1126 -0
- package/heuristics/dependencies/index.cjs.js.map +1 -0
- package/heuristics/dependencies/index.d.ts +2 -0
- package/heuristics/dependencies/index.d.ts.map +1 -0
- package/heuristics/dependencies/index.esm.js +1122 -0
- package/heuristics/dependencies/index.esm.js.map +1 -0
- package/heuristics/entry-points/discover.d.ts +86 -0
- package/heuristics/entry-points/discover.d.ts.map +1 -0
- package/heuristics/entry-points/index.cjs.js +1581 -0
- package/heuristics/entry-points/index.cjs.js.map +1 -0
- package/heuristics/entry-points/index.d.ts +2 -0
- package/heuristics/entry-points/index.d.ts.map +1 -0
- package/heuristics/entry-points/index.esm.js +1577 -0
- package/heuristics/entry-points/index.esm.js.map +1 -0
- package/heuristics/framework/identify.d.ts +84 -0
- package/heuristics/framework/identify.d.ts.map +1 -0
- package/heuristics/framework/index.cjs.js +3618 -0
- package/heuristics/framework/index.cjs.js.map +1 -0
- package/heuristics/framework/index.d.ts +2 -0
- package/heuristics/framework/index.d.ts.map +1 -0
- package/heuristics/framework/index.esm.js +3614 -0
- package/heuristics/framework/index.esm.js.map +1 -0
- package/heuristics/index.cjs.js +4833 -0
- package/heuristics/index.cjs.js.map +1 -0
- package/heuristics/index.d.ts +5 -0
- package/heuristics/index.d.ts.map +1 -0
- package/heuristics/index.esm.js +4822 -0
- package/heuristics/index.esm.js.map +1 -0
- package/heuristics/project-type/detect.d.ts +61 -0
- package/heuristics/project-type/detect.d.ts.map +1 -0
- package/heuristics/project-type/index.cjs.js +3633 -0
- package/heuristics/project-type/index.cjs.js.map +1 -0
- package/heuristics/project-type/index.d.ts +2 -0
- package/heuristics/project-type/index.d.ts.map +1 -0
- package/heuristics/project-type/index.esm.js +3631 -0
- package/heuristics/project-type/index.esm.js.map +1 -0
- package/index.cjs.js +10255 -0
- package/index.cjs.js.map +1 -0
- package/index.d.ts +10 -0
- package/index.d.ts.map +1 -0
- package/index.esm.js +10006 -0
- package/index.esm.js.map +1 -0
- package/models/index.cjs.js +3 -0
- package/models/index.cjs.js.map +1 -0
- package/models/index.d.ts +176 -0
- package/models/index.d.ts.map +1 -0
- package/models/index.esm.js +2 -0
- package/models/index.esm.js.map +1 -0
- package/nx/detect.d.ts +105 -0
- package/nx/detect.d.ts.map +1 -0
- package/nx/devkit-loader.d.ts +62 -0
- package/nx/devkit-loader.d.ts.map +1 -0
- package/nx/index.cjs.js +1302 -0
- package/nx/index.cjs.js.map +1 -0
- package/nx/index.d.ts +4 -0
- package/nx/index.d.ts.map +1 -0
- package/nx/index.esm.js +1286 -0
- package/nx/index.esm.js.map +1 -0
- package/nx/project-config.d.ts +109 -0
- package/nx/project-config.d.ts.map +1 -0
- package/package.json +218 -0
- package/project/config/detect.d.ts +77 -0
- package/project/config/detect.d.ts.map +1 -0
- package/project/config/index.cjs.js +1982 -0
- package/project/config/index.cjs.js.map +1 -0
- package/project/config/index.d.ts +4 -0
- package/project/config/index.d.ts.map +1 -0
- package/project/config/index.esm.js +1971 -0
- package/project/config/index.esm.js.map +1 -0
- package/project/config/parse.d.ts +53 -0
- package/project/config/parse.d.ts.map +1 -0
- package/project/config/patterns.d.ts +31 -0
- package/project/config/patterns.d.ts.map +1 -0
- package/project/index.cjs.js +2585 -0
- package/project/index.cjs.js.map +1 -0
- package/project/index.d.ts +5 -0
- package/project/index.d.ts.map +1 -0
- package/project/index.esm.js +2549 -0
- package/project/index.esm.js.map +1 -0
- package/project/package/dependencies.d.ts +101 -0
- package/project/package/dependencies.d.ts.map +1 -0
- package/project/package/index.cjs.js +972 -0
- package/project/package/index.cjs.js.map +1 -0
- package/project/package/index.d.ts +3 -0
- package/project/package/index.d.ts.map +1 -0
- package/project/package/index.esm.js +957 -0
- package/project/package/index.esm.js.map +1 -0
- package/project/package/read.d.ts +66 -0
- package/project/package/read.d.ts.map +1 -0
- package/project/root/detect.d.ts +65 -0
- package/project/root/detect.d.ts.map +1 -0
- package/project/root/index.cjs.js +860 -0
- package/project/root/index.cjs.js.map +1 -0
- package/project/root/index.d.ts +2 -0
- package/project/root/index.d.ts.map +1 -0
- package/project/root/index.esm.js +853 -0
- package/project/root/index.esm.js.map +1 -0
- package/project/traversal/index.cjs.js +1179 -0
- package/project/traversal/index.cjs.js.map +1 -0
- package/project/traversal/index.d.ts +3 -0
- package/project/traversal/index.d.ts.map +1 -0
- package/project/traversal/index.esm.js +1173 -0
- package/project/traversal/index.esm.js.map +1 -0
- package/project/traversal/search.d.ts +59 -0
- package/project/traversal/search.d.ts.map +1 -0
- package/project/traversal/walk.d.ts +63 -0
- package/project/traversal/walk.d.ts.map +1 -0
- package/tech/backend/detect-all.d.ts +13 -0
- package/tech/backend/detect-all.d.ts.map +1 -0
- package/tech/backend/express.d.ts +11 -0
- package/tech/backend/express.d.ts.map +1 -0
- package/tech/backend/fastify.d.ts +11 -0
- package/tech/backend/fastify.d.ts.map +1 -0
- package/tech/backend/hono.d.ts +11 -0
- package/tech/backend/hono.d.ts.map +1 -0
- package/tech/backend/index.cjs.js +939 -0
- package/tech/backend/index.cjs.js.map +1 -0
- package/tech/backend/index.d.ts +8 -0
- package/tech/backend/index.d.ts.map +1 -0
- package/tech/backend/index.esm.js +931 -0
- package/tech/backend/index.esm.js.map +1 -0
- package/tech/backend/koa.d.ts +11 -0
- package/tech/backend/koa.d.ts.map +1 -0
- package/tech/backend/nestjs.d.ts +11 -0
- package/tech/backend/nestjs.d.ts.map +1 -0
- package/tech/backend/types.d.ts +31 -0
- package/tech/backend/types.d.ts.map +1 -0
- package/tech/build/babel.d.ts +13 -0
- package/tech/build/babel.d.ts.map +1 -0
- package/tech/build/detect-all.d.ts +13 -0
- package/tech/build/detect-all.d.ts.map +1 -0
- package/tech/build/esbuild.d.ts +11 -0
- package/tech/build/esbuild.d.ts.map +1 -0
- package/tech/build/index.cjs.js +1118 -0
- package/tech/build/index.cjs.js.map +1 -0
- package/tech/build/index.d.ts +10 -0
- package/tech/build/index.d.ts.map +1 -0
- package/tech/build/index.esm.js +1102 -0
- package/tech/build/index.esm.js.map +1 -0
- package/tech/build/parcel.d.ts +13 -0
- package/tech/build/parcel.d.ts.map +1 -0
- package/tech/build/rollup.d.ts +13 -0
- package/tech/build/rollup.d.ts.map +1 -0
- package/tech/build/swc.d.ts +13 -0
- package/tech/build/swc.d.ts.map +1 -0
- package/tech/build/types.d.ts +31 -0
- package/tech/build/types.d.ts.map +1 -0
- package/tech/build/vite.d.ts +13 -0
- package/tech/build/vite.d.ts.map +1 -0
- package/tech/build/webpack.d.ts +13 -0
- package/tech/build/webpack.d.ts.map +1 -0
- package/tech/frontend/angular.d.ts +11 -0
- package/tech/frontend/angular.d.ts.map +1 -0
- package/tech/frontend/astro.d.ts +11 -0
- package/tech/frontend/astro.d.ts.map +1 -0
- package/tech/frontend/detect-all.d.ts +13 -0
- package/tech/frontend/detect-all.d.ts.map +1 -0
- package/tech/frontend/gatsby.d.ts +11 -0
- package/tech/frontend/gatsby.d.ts.map +1 -0
- package/tech/frontend/index.cjs.js +1310 -0
- package/tech/frontend/index.cjs.js.map +1 -0
- package/tech/frontend/index.d.ts +15 -0
- package/tech/frontend/index.d.ts.map +1 -0
- package/tech/frontend/index.esm.js +1295 -0
- package/tech/frontend/index.esm.js.map +1 -0
- package/tech/frontend/nextjs.d.ts +11 -0
- package/tech/frontend/nextjs.d.ts.map +1 -0
- package/tech/frontend/nuxt.d.ts +11 -0
- package/tech/frontend/nuxt.d.ts.map +1 -0
- package/tech/frontend/qwik.d.ts +11 -0
- package/tech/frontend/qwik.d.ts.map +1 -0
- package/tech/frontend/react.d.ts +11 -0
- package/tech/frontend/react.d.ts.map +1 -0
- package/tech/frontend/remix.d.ts +11 -0
- package/tech/frontend/remix.d.ts.map +1 -0
- package/tech/frontend/solid.d.ts +11 -0
- package/tech/frontend/solid.d.ts.map +1 -0
- package/tech/frontend/svelte.d.ts +11 -0
- package/tech/frontend/svelte.d.ts.map +1 -0
- package/tech/frontend/sveltekit.d.ts +11 -0
- package/tech/frontend/sveltekit.d.ts.map +1 -0
- package/tech/frontend/types.d.ts +35 -0
- package/tech/frontend/types.d.ts.map +1 -0
- package/tech/frontend/vue.d.ts +11 -0
- package/tech/frontend/vue.d.ts.map +1 -0
- package/tech/index.cjs.js +3684 -0
- package/tech/index.cjs.js.map +1 -0
- package/tech/index.d.ts +96 -0
- package/tech/index.d.ts.map +1 -0
- package/tech/index.esm.js +3603 -0
- package/tech/index.esm.js.map +1 -0
- package/tech/legacy/angularjs.d.ts +12 -0
- package/tech/legacy/angularjs.d.ts.map +1 -0
- package/tech/legacy/backbone.d.ts +11 -0
- package/tech/legacy/backbone.d.ts.map +1 -0
- package/tech/legacy/detect-all.d.ts +13 -0
- package/tech/legacy/detect-all.d.ts.map +1 -0
- package/tech/legacy/ember.d.ts +11 -0
- package/tech/legacy/ember.d.ts.map +1 -0
- package/tech/legacy/index.cjs.js +903 -0
- package/tech/legacy/index.cjs.js.map +1 -0
- package/tech/legacy/index.d.ts +7 -0
- package/tech/legacy/index.d.ts.map +1 -0
- package/tech/legacy/index.esm.js +896 -0
- package/tech/legacy/index.esm.js.map +1 -0
- package/tech/legacy/jquery.d.ts +11 -0
- package/tech/legacy/jquery.d.ts.map +1 -0
- package/tech/legacy/types.d.ts +33 -0
- package/tech/legacy/types.d.ts.map +1 -0
- package/tech/linting/biome.d.ts +11 -0
- package/tech/linting/biome.d.ts.map +1 -0
- package/tech/linting/detect-all.d.ts +13 -0
- package/tech/linting/detect-all.d.ts.map +1 -0
- package/tech/linting/eslint.d.ts +13 -0
- package/tech/linting/eslint.d.ts.map +1 -0
- package/tech/linting/index.cjs.js +992 -0
- package/tech/linting/index.cjs.js.map +1 -0
- package/tech/linting/index.d.ts +7 -0
- package/tech/linting/index.d.ts.map +1 -0
- package/tech/linting/index.esm.js +982 -0
- package/tech/linting/index.esm.js.map +1 -0
- package/tech/linting/prettier.d.ts +13 -0
- package/tech/linting/prettier.d.ts.map +1 -0
- package/tech/linting/stylelint.d.ts +13 -0
- package/tech/linting/stylelint.d.ts.map +1 -0
- package/tech/linting/types.d.ts +31 -0
- package/tech/linting/types.d.ts.map +1 -0
- package/tech/monorepo/detect-all.d.ts +13 -0
- package/tech/monorepo/detect-all.d.ts.map +1 -0
- package/tech/monorepo/index.cjs.js +1021 -0
- package/tech/monorepo/index.cjs.js.map +1 -0
- package/tech/monorepo/index.d.ts +10 -0
- package/tech/monorepo/index.d.ts.map +1 -0
- package/tech/monorepo/index.esm.js +1011 -0
- package/tech/monorepo/index.esm.js.map +1 -0
- package/tech/monorepo/lerna.d.ts +11 -0
- package/tech/monorepo/lerna.d.ts.map +1 -0
- package/tech/monorepo/npm-workspaces.d.ts +11 -0
- package/tech/monorepo/npm-workspaces.d.ts.map +1 -0
- package/tech/monorepo/nx.d.ts +11 -0
- package/tech/monorepo/nx.d.ts.map +1 -0
- package/tech/monorepo/pnpm-workspaces.d.ts +9 -0
- package/tech/monorepo/pnpm-workspaces.d.ts.map +1 -0
- package/tech/monorepo/rush.d.ts +11 -0
- package/tech/monorepo/rush.d.ts.map +1 -0
- package/tech/monorepo/turborepo.d.ts +11 -0
- package/tech/monorepo/turborepo.d.ts.map +1 -0
- package/tech/monorepo/types.d.ts +39 -0
- package/tech/monorepo/types.d.ts.map +1 -0
- package/tech/monorepo/yarn-workspaces.d.ts +11 -0
- package/tech/monorepo/yarn-workspaces.d.ts.map +1 -0
- package/tech/shared-utils/detector-helpers.d.ts +52 -0
- package/tech/shared-utils/detector-helpers.d.ts.map +1 -0
- package/tech/shared-utils/types.d.ts +41 -0
- package/tech/shared-utils/types.d.ts.map +1 -0
- package/tech/testing/cypress.d.ts +13 -0
- package/tech/testing/cypress.d.ts.map +1 -0
- package/tech/testing/detect-all.d.ts +13 -0
- package/tech/testing/detect-all.d.ts.map +1 -0
- package/tech/testing/index.cjs.js +1031 -0
- package/tech/testing/index.cjs.js.map +1 -0
- package/tech/testing/index.d.ts +8 -0
- package/tech/testing/index.d.ts.map +1 -0
- package/tech/testing/index.esm.js +1018 -0
- package/tech/testing/index.esm.js.map +1 -0
- package/tech/testing/jest.d.ts +13 -0
- package/tech/testing/jest.d.ts.map +1 -0
- package/tech/testing/mocha.d.ts +13 -0
- package/tech/testing/mocha.d.ts.map +1 -0
- package/tech/testing/playwright.d.ts +13 -0
- package/tech/testing/playwright.d.ts.map +1 -0
- package/tech/testing/types.d.ts +35 -0
- package/tech/testing/types.d.ts.map +1 -0
- package/tech/testing/vitest.d.ts +13 -0
- package/tech/testing/vitest.d.ts.map +1 -0
- package/tech/types/detectors.d.ts +67 -0
- package/tech/types/detectors.d.ts.map +1 -0
- package/tech/types/index.cjs.js +1045 -0
- package/tech/types/index.cjs.js.map +1 -0
- package/tech/types/index.d.ts +2 -0
- package/tech/types/index.d.ts.map +1 -0
- package/tech/types/index.esm.js +1039 -0
- package/tech/types/index.esm.js.map +1 -0
- package/vfs/commit.d.ts +32 -0
- package/vfs/commit.d.ts.map +1 -0
- package/vfs/diff.d.ts +73 -0
- package/vfs/diff.d.ts.map +1 -0
- package/vfs/factory.d.ts +37 -0
- package/vfs/factory.d.ts.map +1 -0
- package/vfs/fs-tree.d.ts +13 -0
- package/vfs/fs-tree.d.ts.map +1 -0
- package/vfs/index.cjs.js +1600 -0
- package/vfs/index.cjs.js.map +1 -0
- package/vfs/index.d.ts +6 -0
- package/vfs/index.d.ts.map +1 -0
- package/vfs/index.esm.js +1590 -0
- package/vfs/index.esm.js.map +1 -0
- package/vfs/types.d.ts +178 -0
- package/vfs/types.d.ts.map +1 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var node_fs = require('node:fs');
|
|
4
|
+
var node_os = require('node:os');
|
|
5
|
+
var node_path = require('node:path');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Cached platform info (computed once).
|
|
9
|
+
*/
|
|
10
|
+
let cachedPlatformInfo = null;
|
|
11
|
+
/**
|
|
12
|
+
* Cached case sensitivity result.
|
|
13
|
+
*/
|
|
14
|
+
let cachedCaseSensitive = null;
|
|
15
|
+
/**
|
|
16
|
+
* Detect if file system is case sensitive.
|
|
17
|
+
*
|
|
18
|
+
* @returns True if file system is case-sensitive
|
|
19
|
+
*/
|
|
20
|
+
function detectCaseSensitivity() {
|
|
21
|
+
if (cachedCaseSensitive !== null) {
|
|
22
|
+
return cachedCaseSensitive;
|
|
23
|
+
}
|
|
24
|
+
// Quick check based on platform
|
|
25
|
+
if (process.platform === 'win32') {
|
|
26
|
+
cachedCaseSensitive = false;
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
// macOS is typically case-insensitive by default
|
|
30
|
+
if (process.platform === 'darwin') {
|
|
31
|
+
// Could be case-sensitive HFS+/APFS, but assume insensitive by default
|
|
32
|
+
cachedCaseSensitive = false;
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
// Test actual file system behavior for Linux and others
|
|
36
|
+
// Use mkdtempSync to create a secure temporary directory
|
|
37
|
+
let secureTestDir = null;
|
|
38
|
+
try {
|
|
39
|
+
secureTestDir = node_fs.mkdtempSync(node_path.join(node_os.tmpdir(), 'case-sensitivity-test-'));
|
|
40
|
+
const testFile = node_path.join(secureTestDir, 'A');
|
|
41
|
+
const testFileLower = node_path.join(secureTestDir, 'a');
|
|
42
|
+
node_fs.writeFileSync(testFile, '');
|
|
43
|
+
cachedCaseSensitive = !node_fs.existsSync(testFileLower);
|
|
44
|
+
node_fs.unlinkSync(testFile);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// Default to case-sensitive on Linux/Unix if test fails
|
|
48
|
+
// (win32 and darwin already returned early, so we're on a case-sensitive platform)
|
|
49
|
+
cachedCaseSensitive = true;
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
// Clean up the secure temporary directory
|
|
53
|
+
if (secureTestDir) {
|
|
54
|
+
try {
|
|
55
|
+
node_fs.rmdirSync(secureTestDir);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
// Ignore cleanup errors
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return cachedCaseSensitive;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Check if file system is case-sensitive.
|
|
66
|
+
*
|
|
67
|
+
* @returns True if file system is case-sensitive
|
|
68
|
+
*/
|
|
69
|
+
function isCaseSensitiveFs() {
|
|
70
|
+
return detectCaseSensitivity();
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get comprehensive platform information.
|
|
74
|
+
*
|
|
75
|
+
* @returns Platform information object (cached after first call)
|
|
76
|
+
*/
|
|
77
|
+
function getPlatformInfo() {
|
|
78
|
+
if (cachedPlatformInfo) {
|
|
79
|
+
return cachedPlatformInfo;
|
|
80
|
+
}
|
|
81
|
+
const os = node_os.platform();
|
|
82
|
+
const archInfo = node_os.arch();
|
|
83
|
+
let osName;
|
|
84
|
+
switch (os) {
|
|
85
|
+
case 'win32':
|
|
86
|
+
osName = 'win32';
|
|
87
|
+
break;
|
|
88
|
+
case 'darwin':
|
|
89
|
+
osName = 'darwin';
|
|
90
|
+
break;
|
|
91
|
+
case 'linux':
|
|
92
|
+
osName = 'linux';
|
|
93
|
+
break;
|
|
94
|
+
case 'freebsd':
|
|
95
|
+
osName = 'freebsd';
|
|
96
|
+
break;
|
|
97
|
+
case 'sunos':
|
|
98
|
+
osName = 'sunos';
|
|
99
|
+
break;
|
|
100
|
+
case 'aix':
|
|
101
|
+
osName = 'aix';
|
|
102
|
+
break;
|
|
103
|
+
default:
|
|
104
|
+
osName = 'other';
|
|
105
|
+
}
|
|
106
|
+
cachedPlatformInfo = {
|
|
107
|
+
os: osName,
|
|
108
|
+
arch: archInfo,
|
|
109
|
+
nodeVersion: process.versions.node,
|
|
110
|
+
isWindows: osName === 'win32',
|
|
111
|
+
isMac: osName === 'darwin',
|
|
112
|
+
isLinux: osName === 'linux',
|
|
113
|
+
caseSensitive: detectCaseSensitivity(),
|
|
114
|
+
pathSeparator: osName === 'win32' ? '\\' : '/',
|
|
115
|
+
lineEnding: osName === 'win32' ? '\r\n' : '\n',
|
|
116
|
+
};
|
|
117
|
+
return cachedPlatformInfo;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Detect current platform.
|
|
121
|
+
*
|
|
122
|
+
* @returns Platform information object
|
|
123
|
+
*/
|
|
124
|
+
function detectPlatform() {
|
|
125
|
+
return getPlatformInfo();
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Check if running on Windows.
|
|
129
|
+
*
|
|
130
|
+
* @returns True if running on Windows
|
|
131
|
+
*/
|
|
132
|
+
function isWindows() {
|
|
133
|
+
return process.platform === 'win32';
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Check if running on macOS.
|
|
137
|
+
*
|
|
138
|
+
* @returns True if running on macOS
|
|
139
|
+
*/
|
|
140
|
+
function isMac() {
|
|
141
|
+
return process.platform === 'darwin';
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Check if running on Linux.
|
|
145
|
+
*
|
|
146
|
+
* @returns True if running on Linux
|
|
147
|
+
*/
|
|
148
|
+
function isLinux() {
|
|
149
|
+
return process.platform === 'linux';
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** Unix line ending */
|
|
153
|
+
const LF = '\n';
|
|
154
|
+
/** Windows line ending */
|
|
155
|
+
const CRLF = '\r\n';
|
|
156
|
+
/**
|
|
157
|
+
* Get platform-appropriate line ending.
|
|
158
|
+
*
|
|
159
|
+
* @returns Line ending for current platform
|
|
160
|
+
*/
|
|
161
|
+
function getLineEnding() {
|
|
162
|
+
return isWindows() ? CRLF : LF;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Get platform-appropriate path separator.
|
|
166
|
+
*
|
|
167
|
+
* @returns Path separator for current platform
|
|
168
|
+
*/
|
|
169
|
+
function getPathSeparator() {
|
|
170
|
+
return isWindows() ? '\\' : '/';
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Normalize line endings in content.
|
|
174
|
+
*
|
|
175
|
+
* @param content - Content to normalize
|
|
176
|
+
* @param style - Target line ending style ('lf', 'crlf', or 'auto' for platform default)
|
|
177
|
+
* @returns Content with normalized line endings
|
|
178
|
+
*/
|
|
179
|
+
function normalizeLineEndings(content, style = 'lf') {
|
|
180
|
+
let target;
|
|
181
|
+
if (style === 'auto') {
|
|
182
|
+
target = isWindows() ? CRLF : LF;
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
target = style === 'crlf' ? CRLF : LF;
|
|
186
|
+
}
|
|
187
|
+
// First normalize all to LF, then convert to target
|
|
188
|
+
const normalized = content.replace(/\r\n/g, LF).replace(/\r/g, LF);
|
|
189
|
+
if (target === LF) {
|
|
190
|
+
return normalized;
|
|
191
|
+
}
|
|
192
|
+
return normalized.replace(/\n/g, target);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Detect line ending style used in content.
|
|
196
|
+
*
|
|
197
|
+
* @param content - Content to analyze
|
|
198
|
+
* @returns Detected line ending style
|
|
199
|
+
*/
|
|
200
|
+
function detectLineEnding(content) {
|
|
201
|
+
const hasCRLF = content.includes(CRLF);
|
|
202
|
+
// Check for LF that is NOT part of CRLF
|
|
203
|
+
const hasLFOnly = content.includes('\n') && content.replace(/\r\n/g, '').includes('\n');
|
|
204
|
+
if (hasCRLF && hasLFOnly)
|
|
205
|
+
return 'mixed';
|
|
206
|
+
if (hasCRLF)
|
|
207
|
+
return 'crlf';
|
|
208
|
+
if (content.includes('\n'))
|
|
209
|
+
return 'lf';
|
|
210
|
+
return 'none';
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Compare paths with case sensitivity awareness.
|
|
214
|
+
*
|
|
215
|
+
* @param path1 - First path
|
|
216
|
+
* @param path2 - Second path
|
|
217
|
+
* @returns True if paths are equal (respecting case sensitivity)
|
|
218
|
+
*/
|
|
219
|
+
function pathsEqual(path1, path2) {
|
|
220
|
+
const caseSensitive = detectCaseSensitivity();
|
|
221
|
+
if (caseSensitive) {
|
|
222
|
+
return path1 === path2;
|
|
223
|
+
}
|
|
224
|
+
return path1.toLowerCase() === path2.toLowerCase();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
exports.CRLF = CRLF;
|
|
228
|
+
exports.LF = LF;
|
|
229
|
+
exports.detectCaseSensitivity = detectCaseSensitivity;
|
|
230
|
+
exports.detectLineEnding = detectLineEnding;
|
|
231
|
+
exports.detectPlatform = detectPlatform;
|
|
232
|
+
exports.getLineEnding = getLineEnding;
|
|
233
|
+
exports.getPathSeparator = getPathSeparator;
|
|
234
|
+
exports.getPlatformInfo = getPlatformInfo;
|
|
235
|
+
exports.isCaseSensitiveFs = isCaseSensitiveFs;
|
|
236
|
+
exports.isLinux = isLinux;
|
|
237
|
+
exports.isMac = isMac;
|
|
238
|
+
exports.isWindows = isWindows;
|
|
239
|
+
exports.normalizeLineEndings = normalizeLineEndings;
|
|
240
|
+
exports.pathsEqual = pathsEqual;
|
|
241
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../../../../../../../../../libs/project-scope/src/core/platform/detect.ts","../../../../../../../../../../libs/project-scope/src/core/platform/line-endings.ts"],"sourcesContent":[null,null],"names":["mkdtempSync","join","tmpdir","writeFileSync","existsSync","unlinkSync","rmdirSync","platform","arch"],"mappings":";;;;;;AA4BA;;AAEG;AACH,IAAI,kBAAkB,GAAwB,IAAI;AAElD;;AAEG;AACH,IAAI,mBAAmB,GAAmB,IAAI;AAE9C;;;;AAIG;SACa,qBAAqB,GAAA;AACnC,IAAA,IAAI,mBAAmB,KAAK,IAAI,EAAE;AAChC,QAAA,OAAO,mBAAmB;IAC5B;;AAGA,IAAA,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;QAChC,mBAAmB,GAAG,KAAK;AAC3B,QAAA,OAAO,KAAK;IACd;;AAGA,IAAA,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE;;QAEjC,mBAAmB,G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/platform/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { mkdtempSync, writeFileSync, existsSync, unlinkSync, rmdirSync } from 'node:fs';
|
|
2
|
+
import { tmpdir, platform, arch } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Cached platform info (computed once).
|
|
7
|
+
*/
|
|
8
|
+
let cachedPlatformInfo = null;
|
|
9
|
+
/**
|
|
10
|
+
* Cached case sensitivity result.
|
|
11
|
+
*/
|
|
12
|
+
let cachedCaseSensitive = null;
|
|
13
|
+
/**
|
|
14
|
+
* Detect if file system is case sensitive.
|
|
15
|
+
*
|
|
16
|
+
* @returns True if file system is case-sensitive
|
|
17
|
+
*/
|
|
18
|
+
function detectCaseSensitivity() {
|
|
19
|
+
if (cachedCaseSensitive !== null) {
|
|
20
|
+
return cachedCaseSensitive;
|
|
21
|
+
}
|
|
22
|
+
// Quick check based on platform
|
|
23
|
+
if (process.platform === 'win32') {
|
|
24
|
+
cachedCaseSensitive = false;
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
// macOS is typically case-insensitive by default
|
|
28
|
+
if (process.platform === 'darwin') {
|
|
29
|
+
// Could be case-sensitive HFS+/APFS, but assume insensitive by default
|
|
30
|
+
cachedCaseSensitive = false;
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
// Test actual file system behavior for Linux and others
|
|
34
|
+
// Use mkdtempSync to create a secure temporary directory
|
|
35
|
+
let secureTestDir = null;
|
|
36
|
+
try {
|
|
37
|
+
secureTestDir = mkdtempSync(join(tmpdir(), 'case-sensitivity-test-'));
|
|
38
|
+
const testFile = join(secureTestDir, 'A');
|
|
39
|
+
const testFileLower = join(secureTestDir, 'a');
|
|
40
|
+
writeFileSync(testFile, '');
|
|
41
|
+
cachedCaseSensitive = !existsSync(testFileLower);
|
|
42
|
+
unlinkSync(testFile);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// Default to case-sensitive on Linux/Unix if test fails
|
|
46
|
+
// (win32 and darwin already returned early, so we're on a case-sensitive platform)
|
|
47
|
+
cachedCaseSensitive = true;
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
// Clean up the secure temporary directory
|
|
51
|
+
if (secureTestDir) {
|
|
52
|
+
try {
|
|
53
|
+
rmdirSync(secureTestDir);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// Ignore cleanup errors
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return cachedCaseSensitive;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Check if file system is case-sensitive.
|
|
64
|
+
*
|
|
65
|
+
* @returns True if file system is case-sensitive
|
|
66
|
+
*/
|
|
67
|
+
function isCaseSensitiveFs() {
|
|
68
|
+
return detectCaseSensitivity();
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get comprehensive platform information.
|
|
72
|
+
*
|
|
73
|
+
* @returns Platform information object (cached after first call)
|
|
74
|
+
*/
|
|
75
|
+
function getPlatformInfo() {
|
|
76
|
+
if (cachedPlatformInfo) {
|
|
77
|
+
return cachedPlatformInfo;
|
|
78
|
+
}
|
|
79
|
+
const os = platform();
|
|
80
|
+
const archInfo = arch();
|
|
81
|
+
let osName;
|
|
82
|
+
switch (os) {
|
|
83
|
+
case 'win32':
|
|
84
|
+
osName = 'win32';
|
|
85
|
+
break;
|
|
86
|
+
case 'darwin':
|
|
87
|
+
osName = 'darwin';
|
|
88
|
+
break;
|
|
89
|
+
case 'linux':
|
|
90
|
+
osName = 'linux';
|
|
91
|
+
break;
|
|
92
|
+
case 'freebsd':
|
|
93
|
+
osName = 'freebsd';
|
|
94
|
+
break;
|
|
95
|
+
case 'sunos':
|
|
96
|
+
osName = 'sunos';
|
|
97
|
+
break;
|
|
98
|
+
case 'aix':
|
|
99
|
+
osName = 'aix';
|
|
100
|
+
break;
|
|
101
|
+
default:
|
|
102
|
+
osName = 'other';
|
|
103
|
+
}
|
|
104
|
+
cachedPlatformInfo = {
|
|
105
|
+
os: osName,
|
|
106
|
+
arch: archInfo,
|
|
107
|
+
nodeVersion: process.versions.node,
|
|
108
|
+
isWindows: osName === 'win32',
|
|
109
|
+
isMac: osName === 'darwin',
|
|
110
|
+
isLinux: osName === 'linux',
|
|
111
|
+
caseSensitive: detectCaseSensitivity(),
|
|
112
|
+
pathSeparator: osName === 'win32' ? '\\' : '/',
|
|
113
|
+
lineEnding: osName === 'win32' ? '\r\n' : '\n',
|
|
114
|
+
};
|
|
115
|
+
return cachedPlatformInfo;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Detect current platform.
|
|
119
|
+
*
|
|
120
|
+
* @returns Platform information object
|
|
121
|
+
*/
|
|
122
|
+
function detectPlatform() {
|
|
123
|
+
return getPlatformInfo();
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Check if running on Windows.
|
|
127
|
+
*
|
|
128
|
+
* @returns True if running on Windows
|
|
129
|
+
*/
|
|
130
|
+
function isWindows() {
|
|
131
|
+
return process.platform === 'win32';
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Check if running on macOS.
|
|
135
|
+
*
|
|
136
|
+
* @returns True if running on macOS
|
|
137
|
+
*/
|
|
138
|
+
function isMac() {
|
|
139
|
+
return process.platform === 'darwin';
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Check if running on Linux.
|
|
143
|
+
*
|
|
144
|
+
* @returns True if running on Linux
|
|
145
|
+
*/
|
|
146
|
+
function isLinux() {
|
|
147
|
+
return process.platform === 'linux';
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** Unix line ending */
|
|
151
|
+
const LF = '\n';
|
|
152
|
+
/** Windows line ending */
|
|
153
|
+
const CRLF = '\r\n';
|
|
154
|
+
/**
|
|
155
|
+
* Get platform-appropriate line ending.
|
|
156
|
+
*
|
|
157
|
+
* @returns Line ending for current platform
|
|
158
|
+
*/
|
|
159
|
+
function getLineEnding() {
|
|
160
|
+
return isWindows() ? CRLF : LF;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Get platform-appropriate path separator.
|
|
164
|
+
*
|
|
165
|
+
* @returns Path separator for current platform
|
|
166
|
+
*/
|
|
167
|
+
function getPathSeparator() {
|
|
168
|
+
return isWindows() ? '\\' : '/';
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Normalize line endings in content.
|
|
172
|
+
*
|
|
173
|
+
* @param content - Content to normalize
|
|
174
|
+
* @param style - Target line ending style ('lf', 'crlf', or 'auto' for platform default)
|
|
175
|
+
* @returns Content with normalized line endings
|
|
176
|
+
*/
|
|
177
|
+
function normalizeLineEndings(content, style = 'lf') {
|
|
178
|
+
let target;
|
|
179
|
+
if (style === 'auto') {
|
|
180
|
+
target = isWindows() ? CRLF : LF;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
target = style === 'crlf' ? CRLF : LF;
|
|
184
|
+
}
|
|
185
|
+
// First normalize all to LF, then convert to target
|
|
186
|
+
const normalized = content.replace(/\r\n/g, LF).replace(/\r/g, LF);
|
|
187
|
+
if (target === LF) {
|
|
188
|
+
return normalized;
|
|
189
|
+
}
|
|
190
|
+
return normalized.replace(/\n/g, target);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Detect line ending style used in content.
|
|
194
|
+
*
|
|
195
|
+
* @param content - Content to analyze
|
|
196
|
+
* @returns Detected line ending style
|
|
197
|
+
*/
|
|
198
|
+
function detectLineEnding(content) {
|
|
199
|
+
const hasCRLF = content.includes(CRLF);
|
|
200
|
+
// Check for LF that is NOT part of CRLF
|
|
201
|
+
const hasLFOnly = content.includes('\n') && content.replace(/\r\n/g, '').includes('\n');
|
|
202
|
+
if (hasCRLF && hasLFOnly)
|
|
203
|
+
return 'mixed';
|
|
204
|
+
if (hasCRLF)
|
|
205
|
+
return 'crlf';
|
|
206
|
+
if (content.includes('\n'))
|
|
207
|
+
return 'lf';
|
|
208
|
+
return 'none';
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Compare paths with case sensitivity awareness.
|
|
212
|
+
*
|
|
213
|
+
* @param path1 - First path
|
|
214
|
+
* @param path2 - Second path
|
|
215
|
+
* @returns True if paths are equal (respecting case sensitivity)
|
|
216
|
+
*/
|
|
217
|
+
function pathsEqual(path1, path2) {
|
|
218
|
+
const caseSensitive = detectCaseSensitivity();
|
|
219
|
+
if (caseSensitive) {
|
|
220
|
+
return path1 === path2;
|
|
221
|
+
}
|
|
222
|
+
return path1.toLowerCase() === path2.toLowerCase();
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export { CRLF, LF, detectCaseSensitivity, detectLineEnding, detectPlatform, getLineEnding, getPathSeparator, getPlatformInfo, isCaseSensitiveFs, isLinux, isMac, isWindows, normalizeLineEndings, pathsEqual };
|
|
226
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../../../../../../../../libs/project-scope/src/core/platform/detect.ts","../../../../../../../../../../libs/project-scope/src/core/platform/line-endings.ts"],"sourcesContent":[null,null],"names":[],"mappings":";;;;AA4BA;;AAEG;AACH,IAAI,kBAAkB,GAAwB,IAAI;AAElD;;AAEG;AACH,IAAI,mBAAmB,GAAmB,IAAI;AAE9C;;;;AAIG;SACa,qBAAqB,GAAA;AACnC,IAAA,IAAI,mBAAmB,KAAK,IAAI,EAAE;AAChC,QAAA,OAAO,mBAAmB;IAC5B;;AAGA,IAAA,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;QAChC,mBAAmB,GAAG,KAAK;AAC3B,QAAA,OAAO,KAAK;IACd;;AAGA,IAAA,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE;;QAEjC,mBAAmB,G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\n";
|
|
5
|
+
/**
|
|
6
|
+
* Target specification for normalizing line endings.
|
|
7
|
+
*/
|
|
8
|
+
export type LineEndingStyle = 'lf' | 'crlf' | 'auto';
|
|
9
|
+
/**
|
|
10
|
+
* Result of analyzing line endings in content.
|
|
11
|
+
*/
|
|
12
|
+
export type DetectedLineEnding = 'lf' | 'crlf' | 'mixed' | 'none';
|
|
13
|
+
/**
|
|
14
|
+
* Get platform-appropriate line ending.
|
|
15
|
+
*
|
|
16
|
+
* @returns Line ending for current platform
|
|
17
|
+
*/
|
|
18
|
+
export declare function getLineEnding(): '\n' | '\r\n';
|
|
19
|
+
/**
|
|
20
|
+
* Get platform-appropriate path separator.
|
|
21
|
+
*
|
|
22
|
+
* @returns Path separator for current platform
|
|
23
|
+
*/
|
|
24
|
+
export declare function getPathSeparator(): '/' | '\\';
|
|
25
|
+
/**
|
|
26
|
+
* Normalize line endings in content.
|
|
27
|
+
*
|
|
28
|
+
* @param content - Content to normalize
|
|
29
|
+
* @param style - Target line ending style ('lf', 'crlf', or 'auto' for platform default)
|
|
30
|
+
* @returns Content with normalized line endings
|
|
31
|
+
*/
|
|
32
|
+
export declare function normalizeLineEndings(content: string, style?: LineEndingStyle): string;
|
|
33
|
+
/**
|
|
34
|
+
* Detect line ending style used in content.
|
|
35
|
+
*
|
|
36
|
+
* @param content - Content to analyze
|
|
37
|
+
* @returns Detected line ending style
|
|
38
|
+
*/
|
|
39
|
+
export declare function detectLineEnding(content: string): DetectedLineEnding;
|
|
40
|
+
/**
|
|
41
|
+
* Compare paths with case sensitivity awareness.
|
|
42
|
+
*
|
|
43
|
+
* @param path1 - First path
|
|
44
|
+
* @param path2 - Second path
|
|
45
|
+
* @returns True if paths are equal (respecting case sensitivity)
|
|
46
|
+
*/
|
|
47
|
+
export declare function pathsEqual(path1: string, path2: string): boolean;
|
|
48
|
+
//# sourceMappingURL=line-endings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line-endings.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/project-scope/src/core/platform/line-endings.ts"],"names":[],"mappings":"AAEA,uBAAuB;AACvB,eAAO,MAAM,EAAE,OAAO,CAAA;AAEtB,0BAA0B;AAC1B,eAAO,MAAM,IAAI,SAAS,CAAA;AAE1B;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;AAEpD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;AAEjE;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,IAAI,GAAG,MAAM,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,GAAG,GAAG,IAAI,CAE7C;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,eAAsB,GAAG,MAAM,CAiB3F;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,CASpE;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAMhE"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { DependencyGraph } from '../../models';
|
|
2
|
+
/**
|
|
3
|
+
* Circular dependency information.
|
|
4
|
+
*/
|
|
5
|
+
export interface CircularDependency {
|
|
6
|
+
/** Ordered list of files in cycle */
|
|
7
|
+
cycle: string[];
|
|
8
|
+
/** Cycle length */
|
|
9
|
+
length: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Project dependencies categorized.
|
|
13
|
+
*/
|
|
14
|
+
export interface ProjectDependencies {
|
|
15
|
+
/** Production dependencies */
|
|
16
|
+
runtime: string[];
|
|
17
|
+
/** Development dependencies */
|
|
18
|
+
development: string[];
|
|
19
|
+
/** Peer dependencies */
|
|
20
|
+
peer: string[];
|
|
21
|
+
/** Optional dependencies */
|
|
22
|
+
optional: string[];
|
|
23
|
+
/** Total count */
|
|
24
|
+
total: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Options for dependency graph building.
|
|
28
|
+
*/
|
|
29
|
+
export interface BuildGraphOptions {
|
|
30
|
+
/** Maximum depth to traverse */
|
|
31
|
+
maxDepth?: number;
|
|
32
|
+
/** Include node_modules imports */
|
|
33
|
+
includeExternal?: boolean;
|
|
34
|
+
/** File extensions to analyze */
|
|
35
|
+
extensions?: string[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Build dependency graph from source files.
|
|
39
|
+
*
|
|
40
|
+
* Analyzes imports/exports in source files to build a graph of
|
|
41
|
+
* internal dependencies.
|
|
42
|
+
*
|
|
43
|
+
* @param projectPath - Absolute path to project root
|
|
44
|
+
* @param options - Configuration for graph building
|
|
45
|
+
* @returns Dependency graph with nodes, roots, and leaves
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* import { buildDependencyGraph } from '@hyperfrontend/project-scope'
|
|
50
|
+
*
|
|
51
|
+
* const graph = buildDependencyGraph('./my-lib')
|
|
52
|
+
* console.log('Root files:', graph.roots) // Files not imported by anything
|
|
53
|
+
* console.log('Leaf files:', graph.leaves) // Files that don't import anything
|
|
54
|
+
* console.log('Total nodes:', graph.nodes.size)
|
|
55
|
+
*
|
|
56
|
+
* // Examine a specific node's dependencies
|
|
57
|
+
* const node = graph.nodes.get('src/utils/helper.ts')
|
|
58
|
+
* console.log('Depends on:', node?.dependencies)
|
|
59
|
+
* console.log('Used by:', node?.dependents)
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export declare function buildDependencyGraph(projectPath: string, options?: BuildGraphOptions): DependencyGraph;
|
|
63
|
+
/**
|
|
64
|
+
* Find circular dependencies in graph using DFS.
|
|
65
|
+
*
|
|
66
|
+
* @param graph - Dependency graph
|
|
67
|
+
* @returns Array of circular dependencies found
|
|
68
|
+
*/
|
|
69
|
+
export declare function findCircularDependencies(graph: DependencyGraph): CircularDependency[];
|
|
70
|
+
/**
|
|
71
|
+
* Collect all dependencies from package.json grouped by category.
|
|
72
|
+
*
|
|
73
|
+
* @param projectPath - Project directory
|
|
74
|
+
* @returns Dependencies grouped by runtime, dev, peer, and optional
|
|
75
|
+
*/
|
|
76
|
+
export declare function getProjectDependencies(projectPath: string): ProjectDependencies;
|
|
77
|
+
//# sourceMappingURL=analyze.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/project-scope/src/heuristics/dependencies/analyze.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAkB,MAAM,cAAc,CAAA;AAWnE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,qCAAqC;IACrC,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,mBAAmB;IACnB,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,8BAA8B;IAC9B,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,+BAA+B;IAC/B,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,wBAAwB;IACxB,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,gCAAgC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,mCAAmC;IACnC,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,iCAAiC;IACjC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CACtB;AA+HD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,eAAe,CA2FtG;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,eAAe,GAAG,kBAAkB,EAAE,CA+DrF;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,mBAAmB,CA2B/E"}
|