Skip to content

Commit 7ab7b45

Browse files
committed
refactor: remove # path imports and replace with relative paths
- Removed # import map from package.json - Replaced all # imports with relative file paths in source files - Updated tsconfig.json and vitest.config.mts to remove # path aliases - Converted lazy require() calls to top-level imports for circular deps - Updated all scripts to use @socketsecurity/lib-stable/* directly This simplifies the module system by using standard relative imports instead of custom import maps, improving compatibility and clarity.
1 parent cb3810e commit 7ab7b45

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+177
-245
lines changed

.config/esbuild.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import path from 'node:path'
77
import { fileURLToPath } from 'node:url'
88
import fg from 'fast-glob'
99

10-
import { envAsBoolean } from '#socketsecurity/lib/env/helpers'
10+
import { envAsBoolean } from '@socketsecurity/lib-stable/env/helpers'
1111

1212
const __dirname = path.dirname(fileURLToPath(import.meta.url))
1313
const rootPath = path.join(__dirname, '..')

.config/vitest.config.mts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ const vitestConfig = defineConfig({
2626
? ['.ts', '.mts', '.cts', '.js', '.mjs', '.cjs', '.json']
2727
: ['.mts', '.ts', '.mjs', '.js', '.json'],
2828
alias: {
29-
'#env': path.resolve(projectRoot, 'src/env'),
30-
'#constants': path.resolve(projectRoot, 'src/constants'),
31-
'#lib': path.resolve(projectRoot, 'src/lib'),
32-
'#packages': path.resolve(projectRoot, 'src/lib/packages'),
33-
'#types': path.resolve(projectRoot, 'src/types.ts'),
34-
'#utils': path.resolve(projectRoot, 'src/utils'),
3529
cacache: path.resolve(projectRoot, 'src/external/cacache'),
3630
'make-fetch-happen': path.resolve(
3731
projectRoot,

package.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -646,15 +646,6 @@
646646
"./tsconfig.json": "./tsconfig.json",
647647
"./tsconfig.test.json": "./tsconfig.test.json"
648648
},
649-
"imports": {
650-
"#constants/*": "./dist/constants/*.js",
651-
"#env/*": "./dist/env/*.js",
652-
"#lib/*": "./dist/*.js",
653-
"#packages/*": "./dist/packages/*.js",
654-
"#socketsecurity/lib/*": "@socketsecurity/lib-stable/*",
655-
"#types": "./dist/types.js",
656-
"#utils/*": "./dist/utils/*.js"
657-
},
658649
"files": [
659650
"dist",
660651
"data/extensions.json",

scripts/build-externals/bundler.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { createRequire } from 'node:module'
77
import path from 'node:path'
88

99
import esbuild from 'esbuild'
10-
import { getDefaultLogger } from '#socketsecurity/lib/logger'
10+
import { getDefaultLogger } from '@socketsecurity/lib-stable/logger'
1111

1212
import {
1313
getEsbuildConfig,

scripts/build-externals/copy-files.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import { promises as fs } from 'node:fs'
66
import path from 'node:path'
77

8-
import { getDefaultLogger } from '#socketsecurity/lib/logger'
8+
import { getDefaultLogger } from '@socketsecurity/lib-stable/logger'
99

1010
const logger = getDefaultLogger()
1111

scripts/build/clean.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import { fileURLToPath } from 'node:url'
99
import { deleteAsync } from 'del'
1010
import fastGlob from 'fast-glob'
1111

12-
import { isQuiet } from '#socketsecurity/lib/argv/flags'
13-
import { getDefaultLogger } from '#socketsecurity/lib/logger'
14-
import { printHeader } from '#socketsecurity/lib/stdio/header'
12+
import { isQuiet } from '@socketsecurity/lib-stable/argv/flags'
13+
import { getDefaultLogger } from '@socketsecurity/lib-stable/logger'
14+
import { printHeader } from '@socketsecurity/lib-stable/stdio/header'
1515

1616
import { parseArgs } from '../utils/parse-args.mjs'
1717

scripts/build/externals.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
* Entry point that wraps the modular build-externals system.
66
*/
77

8-
import { isQuiet } from '#socketsecurity/lib/argv/flags'
9-
import { getDefaultLogger } from '#socketsecurity/lib/logger'
10-
import { pluralize } from '#socketsecurity/lib/words'
8+
import { isQuiet } from '@socketsecurity/lib-stable/argv/flags'
9+
import { getDefaultLogger } from '@socketsecurity/lib-stable/logger'
10+
import { pluralize } from '@socketsecurity/lib-stable/words'
1111

1212
import { buildExternals } from '../build-externals/orchestrator.mjs'
1313

scripts/build/js.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
buildConfig,
1111
watchConfig,
1212
} from '../../.config/esbuild.config.mjs'
13-
import { getDefaultLogger } from '#socketsecurity/lib/logger'
13+
import { getDefaultLogger } from '@socketsecurity/lib-stable/logger'
1414

1515
const logger = getDefaultLogger()
1616

scripts/build/main.mjs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ import {
1313
buildConfig,
1414
watchConfig,
1515
} from '../../.config/esbuild.config.mjs'
16-
import { isQuiet } from '#socketsecurity/lib/argv/flags'
17-
import { getDefaultLogger } from '#socketsecurity/lib/logger'
18-
import { printFooter, printHeader } from '#socketsecurity/lib/stdio/header'
16+
import { isQuiet } from '@socketsecurity/lib-stable/argv/flags'
17+
import { getDefaultLogger } from '@socketsecurity/lib-stable/logger'
18+
import {
19+
printFooter,
20+
printHeader,
21+
} from '@socketsecurity/lib-stable/stdio/header'
1922

2023
import { parseArgs } from '../utils/parse-args.mjs'
2124
import { runSequence } from '../utils/run-command.mjs'

scripts/check.mjs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@
88
* node scripts/check.mjs
99
*/
1010

11-
import { getDefaultLogger } from '#socketsecurity/lib/logger'
12-
import { printFooter, printHeader } from '#socketsecurity/lib/stdio/header'
11+
import { getDefaultLogger } from '@socketsecurity/lib-stable/logger'
12+
import {
13+
printFooter,
14+
printHeader,
15+
} from '@socketsecurity/lib-stable/stdio/header'
1316

1417
import { runParallel } from './utils/run-command.mjs'
1518

0 commit comments

Comments
 (0)