Skip to content

Commit 89c84b8

Browse files
committed
feat: add #socketsecurity/lib alias for stable npm release
Added Node.js import map alias to reference a stable published npm release (v3.1.3) instead of local workspace source. ## Changes **devDependencies**: - Added `@socketsecurity/lib-stable` from npm registry tarball - Uses https://registry.npmjs.org/@socketsecurity/lib/-/lib-3.1.3.tgz - Avoids workspace linking by using direct tarball URL **package.json imports**: - Added `#socketsecurity/lib/*` → `@socketsecurity/lib-stable/*` - Scripts/tests can import from stable release version **scripts/lint.mjs**: - Fixed import to use `@socketsecurity/lib/git` (removed deleted local file) - Changed async functions to sync (getChangedFilesSync, getStagedFilesSync) ## Usage Scripts and tests can now choose between: - `#lib/*` - Local source (in-development, from `./src`) - `#socketsecurity/lib/*` - Stable npm release (v3.1.3) ## Example ```javascript // Use local in-development version import { getDefaultLogger } from '#lib/logger' // Use stable npm release v3.1.3 import { getDefaultLogger } from '#socketsecurity/lib/logger' ``` ## Why Tarball URL? Direct tarball URL prevents pnpm from linking to local workspace, ensuring the alias references the actual published npm package.
1 parent 8598a74 commit 89c84b8

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@
548548
"#env/*": "./dist/env/*.js",
549549
"#lib/*": "./dist/*.js",
550550
"#packages/*": "./dist/packages/*.js",
551+
"#socketsecurity/lib/*": "@socketsecurity/lib-stable/*",
551552
"#types": "./dist/types.js",
552553
"#utils/*": "./dist/utils/*.js"
553554
},
@@ -594,6 +595,7 @@
594595
"@socketregistry/is-unicode-supported": "1.0.5",
595596
"@socketregistry/packageurl-js": "1.3.5",
596597
"@socketregistry/yocto-spinner": "1.0.19",
598+
"@socketsecurity/lib-stable": "https://registry.npmjs.org/@socketsecurity/lib/-/lib-3.1.3.tgz",
597599
"@types/node": "24.9.2",
598600
"@typescript/native-preview": "7.0.0-dev.20250920.1",
599601
"@vitest/coverage-v8": "4.0.3",

pnpm-lock.yaml

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/lint.mjs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66
import { existsSync, readFileSync } from 'node:fs'
77
import path from 'node:path'
88

9+
import {
10+
getChangedFilesSync,
11+
getStagedFilesSync,
12+
} from '@socketsecurity/lib/git'
13+
914
import { isQuiet } from './utils/flags.mjs'
10-
import { getChangedFiles, getStagedFiles } from './utils/git.mjs'
1115
import { printHeader } from './utils/helpers.mjs'
1216
import { logger } from './utils/logger.mjs'
1317
import { parseArgs } from './utils/parse-args.mjs'
@@ -322,20 +326,20 @@ async function getFilesToLint(options) {
322326

323327
if (staged) {
324328
mode = 'staged'
325-
changedFiles = await getStagedFiles({ absolute: false })
329+
changedFiles = getStagedFilesSync({ absolute: false })
326330
if (!changedFiles.length) {
327331
return { files: null, reason: 'no staged files', mode }
328332
}
329333
} else if (changed) {
330334
mode = 'changed'
331-
changedFiles = await getChangedFiles({ absolute: false })
335+
changedFiles = getChangedFilesSync({ absolute: false })
332336
if (!changedFiles.length) {
333337
return { files: null, reason: 'no changed files', mode }
334338
}
335339
} else {
336340
// Default to changed files if no specific flag
337341
mode = 'changed'
338-
changedFiles = await getChangedFiles({ absolute: false })
342+
changedFiles = getChangedFilesSync({ absolute: false })
339343
if (!changedFiles.length) {
340344
return { files: null, reason: 'no changed files', mode }
341345
}

0 commit comments

Comments
 (0)