File tree Expand file tree Collapse file tree 4 files changed +19
-3
lines changed Expand file tree Collapse file tree 4 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 44 */
55import { PurlError } from './error.js'
66
7- const { decodeURIComponent : decodeComponent } = globalThis
7+ // IMPORTANT: Do not use destructuring here - use direct assignment instead.
8+ // tsgo has a bug that incorrectly transpiles destructured exports, resulting in
9+ // `exports.decodeComponent = void 0;` which causes runtime errors.
10+ // See: https://github.com/SocketDev/socket-packageurl-js/issues/3
11+ const decodeComponent = globalThis . decodeURIComponent
812
913function decodePurlComponent ( comp : string , encodedComponent : string ) : string {
1014 try {
Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ import {
1010import { isObject } from './objects.js'
1111import { isNonEmptyString } from './strings.js'
1212
13+ // IMPORTANT: Do not use destructuring here (e.g., const { encodeURIComponent } = globalThis).
14+ // tsgo has a bug that incorrectly transpiles destructured exports, resulting in
15+ // `exports.encodeComponent = void 0;` which causes runtime errors.
16+ // See: https://github.com/SocketDev/socket-packageurl-js/issues/3
1317const encodeComponent = globalThis . encodeURIComponent
1418
1519function encodeName ( name : unknown ) : string {
Original file line number Diff line number Diff line change @@ -93,7 +93,11 @@ function normalizeVersion(rawVersion: unknown): string | undefined {
9393 return typeof rawVersion === 'string' ? rawVersion . trim ( ) : undefined
9494}
9595
96- const { apply : ReflectApply } = Reflect
96+ // IMPORTANT: Do not use destructuring here - use direct assignment instead.
97+ // tsgo has a bug that incorrectly transpiles destructured exports, resulting in
98+ // `exports.ReflectApply = void 0;` which causes runtime errors.
99+ // See: https://github.com/SocketDev/socket-packageurl-js/issues/3
100+ const ReflectApply = Reflect . apply
97101
98102function qualifiersToEntries (
99103 rawQualifiers : unknown ,
Original file line number Diff line number Diff line change @@ -8,7 +8,11 @@ import { isNonEmptyString } from './strings.js'
88
99import type { QualifiersObject } from './purl-component.js'
1010
11- const { apply : ReflectApply } = Reflect
11+ // IMPORTANT: Do not use destructuring here - use direct assignment instead.
12+ // tsgo has a bug that incorrectly transpiles destructured exports, resulting in
13+ // `exports.ReflectApply = void 0;` which causes runtime errors.
14+ // See: https://github.com/SocketDev/socket-packageurl-js/issues/3
15+ const ReflectApply = Reflect . apply
1216
1317function validateEmptyByType (
1418 type : string ,
You can’t perform that action at this time.
0 commit comments