@hyperfrontend/project-scope 0.2.2 → 0.2.3

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/_shared/core/fs/guard/index.cjs.js +7 -0
  3. package/_shared/core/fs/guard/index.esm.js +5 -0
  4. package/_shared/core/fs/stat/index.cjs.js +3 -2
  5. package/_shared/core/fs/stat/index.esm.js +3 -2
  6. package/_shared/core/path/confine/index.cjs.js +22 -0
  7. package/_shared/core/path/confine/index.esm.js +19 -0
  8. package/cli/index.cjs.js +5 -1
  9. package/cli/index.esm.js +5 -1
  10. package/core/fs/index.cjs.js +12 -2
  11. package/core/fs/index.esm.js +12 -2
  12. package/core/index.cjs.js +13 -3
  13. package/core/index.esm.js +14 -4
  14. package/core/path/index.cjs.js +4 -2
  15. package/core/path/index.d.ts +22 -1
  16. package/core/path/index.d.ts.map +1 -1
  17. package/core/path/index.esm.js +4 -3
  18. package/heuristics/dependencies/index.cjs.js +10 -1
  19. package/heuristics/dependencies/index.esm.js +12 -3
  20. package/heuristics/entry-points/index.cjs.js +2 -1
  21. package/heuristics/entry-points/index.esm.js +2 -1
  22. package/heuristics/framework/index.cjs.js +2 -1
  23. package/heuristics/framework/index.esm.js +2 -1
  24. package/heuristics/index.cjs.js +10 -1
  25. package/heuristics/index.esm.js +12 -3
  26. package/heuristics/project-type/index.cjs.js +2 -1
  27. package/heuristics/project-type/index.esm.js +2 -1
  28. package/index.cjs.js +18 -3
  29. package/index.esm.js +19 -4
  30. package/nx/index.cjs.js +3 -2
  31. package/nx/index.esm.js +3 -2
  32. package/package.json +1 -1
  33. package/project/config/index.cjs.js +5 -1
  34. package/project/config/index.esm.js +5 -1
  35. package/project/index.cjs.js +5 -1
  36. package/project/index.esm.js +5 -1
  37. package/project/package/index.cjs.js +5 -1
  38. package/project/package/index.esm.js +5 -1
  39. package/project/root/index.cjs.js +2 -1
  40. package/project/root/index.esm.js +2 -1
  41. package/project/traversal/index.cjs.js +2 -1
  42. package/project/traversal/index.esm.js +2 -1
  43. package/tech/backend/index.cjs.js +2 -1
  44. package/tech/backend/index.esm.js +2 -1
  45. package/tech/build/index.cjs.js +2 -1
  46. package/tech/build/index.esm.js +2 -1
  47. package/tech/frontend/index.cjs.js +2 -1
  48. package/tech/frontend/index.esm.js +2 -1
  49. package/tech/index.cjs.js +2 -1
  50. package/tech/index.esm.js +2 -1
  51. package/tech/legacy/index.cjs.js +2 -1
  52. package/tech/legacy/index.esm.js +2 -1
  53. package/tech/linting/index.cjs.js +2 -1
  54. package/tech/linting/index.esm.js +2 -1
  55. package/tech/monorepo/index.cjs.js +2 -1
  56. package/tech/monorepo/index.esm.js +2 -1
  57. package/tech/testing/index.cjs.js +2 -1
  58. package/tech/testing/index.esm.js +2 -1
  59. package/tech/types/index.cjs.js +2 -1
  60. package/tech/types/index.esm.js +2 -1
@@ -10,6 +10,7 @@ const node_fs = require('node:fs');
10
10
  const index_cjs_js$3 = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/console/index.cjs.js');
11
11
  const index_cjs_js = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.cjs.js');
12
12
  const index_cjs_js$1 = require('../../_dependencies/@hyperfrontend/logging/index.cjs.js');
13
+ const { isSafePath } = require('../../_shared/core/fs/guard/index.cjs.js');
13
14
  const { join } = require('../../_shared/core/path/join/index.cjs.js');
14
15
  const { collectAllDependencies, parseVersionString, locateConfigFile, filterScriptsByCommand } = require('../../_shared/tech/shared-utils/detector-helpers/index.cjs.js');
15
16
 
@@ -172,7 +173,7 @@ createScopedLogger('project-scope:fs');
172
173
  * ```
173
174
  */
174
175
  function readFileIfExists(filePath, encoding = 'utf-8') {
175
- if (!node_fs.existsSync(filePath)) {
176
+ if (!isSafePath(filePath) || !node_fs.existsSync(filePath)) {
176
177
  return null;
177
178
  }
178
179
  try {
@@ -8,6 +8,7 @@ import { existsSync, readFileSync } from 'node:fs';
8
8
  import { error, warn, log, info, debug } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/console/index.esm.js';
9
9
  import { createSet } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.esm.js';
10
10
  import { createLogger } from '../../_dependencies/@hyperfrontend/logging/index.esm.js';
11
+ import { isSafePath } from '../../_shared/core/fs/guard/index.esm.js';
11
12
  import { join } from '../../_shared/core/path/join/index.esm.js';
12
13
  import { collectAllDependencies, parseVersionString, locateConfigFile, filterScriptsByCommand } from '../../_shared/tech/shared-utils/detector-helpers/index.esm.js';
13
14
 
@@ -170,7 +171,7 @@ createScopedLogger('project-scope:fs');
170
171
  * ```
171
172
  */
172
173
  function readFileIfExists(filePath, encoding = 'utf-8') {
173
- if (!existsSync(filePath)) {
174
+ if (!isSafePath(filePath) || !existsSync(filePath)) {
174
175
  return null;
175
176
  }
176
177
  try {
@@ -10,6 +10,7 @@ const index_cjs_js$2 = require('../../_dependencies/@hyperfrontend/immutable-api
10
10
  const index_cjs_js = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.cjs.js');
11
11
  const index_cjs_js$1 = require('../../_dependencies/@hyperfrontend/logging/index.cjs.js');
12
12
  const index_cjs_js$6 = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.cjs.js');
13
+ const { isSafePath } = require('../../_shared/core/fs/guard/index.cjs.js');
13
14
  const { exists } = require('../../_shared/core/fs/stat/index.cjs.js');
14
15
  const { collectAllDependencies, parseVersionString } = require('../../_shared/tech/shared-utils/detector-helpers/index.cjs.js');
15
16
 
@@ -172,7 +173,7 @@ createScopedLogger('project-scope:fs');
172
173
  * ```
173
174
  */
174
175
  function readFileIfExists(filePath, encoding = 'utf-8') {
175
- if (!node_fs.existsSync(filePath)) {
176
+ if (!isSafePath(filePath) || !node_fs.existsSync(filePath)) {
176
177
  return null;
177
178
  }
178
179
  try {
@@ -8,6 +8,7 @@ import { freeze, entries, keys, values } from '../../_dependencies/@hyperfronten
8
8
  import { createSet } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.esm.js';
9
9
  import { createLogger } from '../../_dependencies/@hyperfrontend/logging/index.esm.js';
10
10
  import { createError } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.esm.js';
11
+ import { isSafePath } from '../../_shared/core/fs/guard/index.esm.js';
11
12
  import { exists } from '../../_shared/core/fs/stat/index.esm.js';
12
13
  import { collectAllDependencies, parseVersionString } from '../../_shared/tech/shared-utils/detector-helpers/index.esm.js';
13
14
 
@@ -170,7 +171,7 @@ createScopedLogger('project-scope:fs');
170
171
  * ```
171
172
  */
172
173
  function readFileIfExists(filePath, encoding = 'utf-8') {
173
- if (!existsSync(filePath)) {
174
+ if (!isSafePath(filePath) || !existsSync(filePath)) {
174
175
  return null;
175
176
  }
176
177
  try {
package/tech/index.cjs.js CHANGED
@@ -11,6 +11,7 @@ const node_path = require('node:path');
11
11
  const index_cjs_js$7 = require('../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.cjs.js');
12
12
  const node_fs = require('node:fs');
13
13
  const index_cjs_js$8 = require('../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.cjs.js');
14
+ const { isSafePath } = require('../_shared/core/fs/guard/index.cjs.js');
14
15
  const { isDirectory, exists } = require('../_shared/core/fs/stat/index.cjs.js');
15
16
  const { join } = require('../_shared/core/path/join/index.cjs.js');
16
17
  const { createCache } = require('../_shared/core/cache/index.cjs.js');
@@ -201,7 +202,7 @@ function createFileSystemError(message, code, context) {
201
202
  * ```
202
203
  */
203
204
  function readFileIfExists(filePath, encoding = 'utf-8') {
204
- if (!node_fs.existsSync(filePath)) {
205
+ if (!isSafePath(filePath) || !node_fs.existsSync(filePath)) {
205
206
  return null;
206
207
  }
207
208
  try {
package/tech/index.esm.js CHANGED
@@ -9,6 +9,7 @@ import { join as join$1 } from 'node:path';
9
9
  import { createError } from '../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.esm.js';
10
10
  import { existsSync, readFileSync, statSync, lstatSync, readdirSync } from 'node:fs';
11
11
  import { min } from '../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.esm.js';
12
+ import { isSafePath } from '../_shared/core/fs/guard/index.esm.js';
12
13
  import { isDirectory, exists } from '../_shared/core/fs/stat/index.esm.js';
13
14
  import { join } from '../_shared/core/path/join/index.esm.js';
14
15
  import { createCache } from '../_shared/core/cache/index.esm.js';
@@ -199,7 +200,7 @@ function createFileSystemError(message, code, context) {
199
200
  * ```
200
201
  */
201
202
  function readFileIfExists(filePath, encoding = 'utf-8') {
202
- if (!existsSync(filePath)) {
203
+ if (!isSafePath(filePath) || !existsSync(filePath)) {
203
204
  return null;
204
205
  }
205
206
  try {
@@ -10,6 +10,7 @@ const node_fs = require('node:fs');
10
10
  const index_cjs_js$3 = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/console/index.cjs.js');
11
11
  const index_cjs_js = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.cjs.js');
12
12
  const index_cjs_js$1 = require('../../_dependencies/@hyperfrontend/logging/index.cjs.js');
13
+ const { isSafePath } = require('../../_shared/core/fs/guard/index.cjs.js');
13
14
  const { collectAllDependencies, parseVersionString } = require('../../_shared/tech/shared-utils/detector-helpers/index.cjs.js');
14
15
 
15
16
  /**
@@ -171,7 +172,7 @@ createScopedLogger('project-scope:fs');
171
172
  * ```
172
173
  */
173
174
  function readFileIfExists(filePath, encoding = 'utf-8') {
174
- if (!node_fs.existsSync(filePath)) {
175
+ if (!isSafePath(filePath) || !node_fs.existsSync(filePath)) {
175
176
  return null;
176
177
  }
177
178
  try {
@@ -8,6 +8,7 @@ import { existsSync, readFileSync } from 'node:fs';
8
8
  import { error, warn, log, info, debug } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/console/index.esm.js';
9
9
  import { createSet } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.esm.js';
10
10
  import { createLogger } from '../../_dependencies/@hyperfrontend/logging/index.esm.js';
11
+ import { isSafePath } from '../../_shared/core/fs/guard/index.esm.js';
11
12
  import { collectAllDependencies, parseVersionString } from '../../_shared/tech/shared-utils/detector-helpers/index.esm.js';
12
13
 
13
14
  /**
@@ -169,7 +170,7 @@ createScopedLogger('project-scope:fs');
169
170
  * ```
170
171
  */
171
172
  function readFileIfExists(filePath, encoding = 'utf-8') {
172
- if (!existsSync(filePath)) {
173
+ if (!isSafePath(filePath) || !existsSync(filePath)) {
173
174
  return null;
174
175
  }
175
176
  try {
@@ -10,6 +10,7 @@ const index_cjs_js$2 = require('../../_dependencies/@hyperfrontend/immutable-api
10
10
  const index_cjs_js = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.cjs.js');
11
11
  const index_cjs_js$1 = require('../../_dependencies/@hyperfrontend/logging/index.cjs.js');
12
12
  const index_cjs_js$6 = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.cjs.js');
13
+ const { isSafePath } = require('../../_shared/core/fs/guard/index.cjs.js');
13
14
  const { exists } = require('../../_shared/core/fs/stat/index.cjs.js');
14
15
  const { join } = require('../../_shared/core/path/join/index.cjs.js');
15
16
  const { collectAllDependencies, parseVersionString, locateConfigFile } = require('../../_shared/tech/shared-utils/detector-helpers/index.cjs.js');
@@ -173,7 +174,7 @@ createScopedLogger('project-scope:fs');
173
174
  * ```
174
175
  */
175
176
  function readFileIfExists(filePath, encoding = 'utf-8') {
176
- if (!node_fs.existsSync(filePath)) {
177
+ if (!isSafePath(filePath) || !node_fs.existsSync(filePath)) {
177
178
  return null;
178
179
  }
179
180
  try {
@@ -8,6 +8,7 @@ import { freeze, entries, keys, values } from '../../_dependencies/@hyperfronten
8
8
  import { createSet } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.esm.js';
9
9
  import { createLogger } from '../../_dependencies/@hyperfrontend/logging/index.esm.js';
10
10
  import { createError } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.esm.js';
11
+ import { isSafePath } from '../../_shared/core/fs/guard/index.esm.js';
11
12
  import { exists } from '../../_shared/core/fs/stat/index.esm.js';
12
13
  import { join } from '../../_shared/core/path/join/index.esm.js';
13
14
  import { collectAllDependencies, parseVersionString, locateConfigFile } from '../../_shared/tech/shared-utils/detector-helpers/index.esm.js';
@@ -171,7 +172,7 @@ createScopedLogger('project-scope:fs');
171
172
  * ```
172
173
  */
173
174
  function readFileIfExists(filePath, encoding = 'utf-8') {
174
- if (!existsSync(filePath)) {
175
+ if (!isSafePath(filePath) || !existsSync(filePath)) {
175
176
  return null;
176
177
  }
177
178
  try {
@@ -10,6 +10,7 @@ const index_cjs_js$3 = require('../../_dependencies/@hyperfrontend/immutable-api
10
10
  const index_cjs_js = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.cjs.js');
11
11
  const index_cjs_js$1 = require('../../_dependencies/@hyperfrontend/logging/index.cjs.js');
12
12
  const index_cjs_js$7 = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.cjs.js');
13
+ const { isSafePath } = require('../../_shared/core/fs/guard/index.cjs.js');
13
14
  const { exists } = require('../../_shared/core/fs/stat/index.cjs.js');
14
15
  const { collectAllDependencies, parseVersionString } = require('../../_shared/tech/shared-utils/detector-helpers/index.cjs.js');
15
16
  const { pnpmWorkspacesDetector } = require('../../_shared/tech/monorepo/pnpm-workspaces/index.cjs.js');
@@ -173,7 +174,7 @@ createScopedLogger('project-scope:fs');
173
174
  * ```
174
175
  */
175
176
  function readFileIfExists(filePath, encoding = 'utf-8') {
176
- if (!node_fs.existsSync(filePath)) {
177
+ if (!isSafePath(filePath) || !node_fs.existsSync(filePath)) {
177
178
  return null;
178
179
  }
179
180
  try {
@@ -8,6 +8,7 @@ import { error, warn, log, info, debug } from '../../_dependencies/@hyperfronten
8
8
  import { createSet } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.esm.js';
9
9
  import { createLogger } from '../../_dependencies/@hyperfrontend/logging/index.esm.js';
10
10
  import { min } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.esm.js';
11
+ import { isSafePath } from '../../_shared/core/fs/guard/index.esm.js';
11
12
  import { exists } from '../../_shared/core/fs/stat/index.esm.js';
12
13
  import { collectAllDependencies, parseVersionString } from '../../_shared/tech/shared-utils/detector-helpers/index.esm.js';
13
14
  import { pnpmWorkspacesDetector } from '../../_shared/tech/monorepo/pnpm-workspaces/index.esm.js';
@@ -171,7 +172,7 @@ createScopedLogger('project-scope:fs');
171
172
  * ```
172
173
  */
173
174
  function readFileIfExists(filePath, encoding = 'utf-8') {
174
- if (!existsSync(filePath)) {
175
+ if (!isSafePath(filePath) || !existsSync(filePath)) {
175
176
  return null;
176
177
  }
177
178
  try {
@@ -10,6 +10,7 @@ const index_cjs_js$2 = require('../../_dependencies/@hyperfrontend/immutable-api
10
10
  const index_cjs_js = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.cjs.js');
11
11
  const index_cjs_js$1 = require('../../_dependencies/@hyperfrontend/logging/index.cjs.js');
12
12
  const index_cjs_js$6 = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.cjs.js');
13
+ const { isSafePath } = require('../../_shared/core/fs/guard/index.cjs.js');
13
14
  const { exists } = require('../../_shared/core/fs/stat/index.cjs.js');
14
15
  const { join } = require('../../_shared/core/path/join/index.cjs.js');
15
16
  const { collectAllDependencies, parseVersionString, locateConfigFile } = require('../../_shared/tech/shared-utils/detector-helpers/index.cjs.js');
@@ -173,7 +174,7 @@ createScopedLogger('project-scope:fs');
173
174
  * ```
174
175
  */
175
176
  function readFileIfExists(filePath, encoding = 'utf-8') {
176
- if (!node_fs.existsSync(filePath)) {
177
+ if (!isSafePath(filePath) || !node_fs.existsSync(filePath)) {
177
178
  return null;
178
179
  }
179
180
  try {
@@ -8,6 +8,7 @@ import { freeze, entries, keys, values } from '../../_dependencies/@hyperfronten
8
8
  import { createSet } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.esm.js';
9
9
  import { createLogger } from '../../_dependencies/@hyperfrontend/logging/index.esm.js';
10
10
  import { createError } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.esm.js';
11
+ import { isSafePath } from '../../_shared/core/fs/guard/index.esm.js';
11
12
  import { exists } from '../../_shared/core/fs/stat/index.esm.js';
12
13
  import { join } from '../../_shared/core/path/join/index.esm.js';
13
14
  import { collectAllDependencies, parseVersionString, locateConfigFile } from '../../_shared/tech/shared-utils/detector-helpers/index.esm.js';
@@ -171,7 +172,7 @@ createScopedLogger('project-scope:fs');
171
172
  * ```
172
173
  */
173
174
  function readFileIfExists(filePath, encoding = 'utf-8') {
174
- if (!existsSync(filePath)) {
175
+ if (!isSafePath(filePath) || !existsSync(filePath)) {
175
176
  return null;
176
177
  }
177
178
  try {
@@ -10,6 +10,7 @@ const index_cjs_js$3 = require('../../_dependencies/@hyperfrontend/immutable-api
10
10
  const index_cjs_js = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.cjs.js');
11
11
  const index_cjs_js$1 = require('../../_dependencies/@hyperfrontend/logging/index.cjs.js');
12
12
  const index_cjs_js$6 = require('../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.cjs.js');
13
+ const { isSafePath } = require('../../_shared/core/fs/guard/index.cjs.js');
13
14
  const { isDirectory, exists } = require('../../_shared/core/fs/stat/index.cjs.js');
14
15
  const { collectAllDependencies, parseVersionString } = require('../../_shared/tech/shared-utils/detector-helpers/index.cjs.js');
15
16
 
@@ -197,7 +198,7 @@ function createFileSystemError(message, code, context) {
197
198
  * ```
198
199
  */
199
200
  function readFileIfExists(filePath, encoding = 'utf-8') {
200
- if (!node_fs.existsSync(filePath)) {
201
+ if (!isSafePath(filePath) || !node_fs.existsSync(filePath)) {
201
202
  return null;
202
203
  }
203
204
  try {
@@ -8,6 +8,7 @@ import { error, warn, log, info, debug } from '../../_dependencies/@hyperfronten
8
8
  import { createSet } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.esm.js';
9
9
  import { createLogger } from '../../_dependencies/@hyperfrontend/logging/index.esm.js';
10
10
  import { createError } from '../../_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.esm.js';
11
+ import { isSafePath } from '../../_shared/core/fs/guard/index.esm.js';
11
12
  import { isDirectory, exists } from '../../_shared/core/fs/stat/index.esm.js';
12
13
  import { collectAllDependencies, parseVersionString } from '../../_shared/tech/shared-utils/detector-helpers/index.esm.js';
13
14
 
@@ -195,7 +196,7 @@ function createFileSystemError(message, code, context) {
195
196
  * ```
196
197
  */
197
198
  function readFileIfExists(filePath, encoding = 'utf-8') {
198
- if (!existsSync(filePath)) {
199
+ if (!isSafePath(filePath) || !existsSync(filePath)) {
199
200
  return null;
200
201
  }
201
202
  try {