diff --git a/snapshots/input/empty-package-fields/package.json b/snapshots/input/empty-package-fields/package.json new file mode 100644 index 00000000..b59977dc --- /dev/null +++ b/snapshots/input/empty-package-fields/package.json @@ -0,0 +1,6 @@ +{ + "name": "", + "version": "1.0.0", + "description": "Example TS/JS project with an empty package name", + "private": true +} diff --git a/snapshots/input/empty-package-fields/src/main.ts b/snapshots/input/empty-package-fields/src/main.ts new file mode 100644 index 00000000..ada3e96a --- /dev/null +++ b/snapshots/input/empty-package-fields/src/main.ts @@ -0,0 +1,3 @@ +export function main(): string { + return '' +} diff --git a/snapshots/input/empty-package-fields/src/version/lib.ts b/snapshots/input/empty-package-fields/src/version/lib.ts new file mode 100644 index 00000000..746b094a --- /dev/null +++ b/snapshots/input/empty-package-fields/src/version/lib.ts @@ -0,0 +1,3 @@ +export function lib(): string { + return '' +} diff --git a/snapshots/input/empty-package-fields/src/version/package.json b/snapshots/input/empty-package-fields/src/version/package.json new file mode 100644 index 00000000..caa280a2 --- /dev/null +++ b/snapshots/input/empty-package-fields/src/version/package.json @@ -0,0 +1,4 @@ +{ + "name": "empty-version", + "version": "" +} diff --git a/snapshots/output/empty-package-fields/src/main.ts b/snapshots/output/empty-package-fields/src/main.ts new file mode 100644 index 00000000..c5cbbcbb --- /dev/null +++ b/snapshots/output/empty-package-fields/src/main.ts @@ -0,0 +1,8 @@ +// language TypeScript +// < definition . 1.0.0 src/`main.ts`/ + +export function main(): string { +// ^^^^ definition . 1.0.0 src/`main.ts`/main(). + return '' +} + diff --git a/snapshots/output/empty-package-fields/src/version/lib.ts b/snapshots/output/empty-package-fields/src/version/lib.ts new file mode 100644 index 00000000..243c0857 --- /dev/null +++ b/snapshots/output/empty-package-fields/src/version/lib.ts @@ -0,0 +1,8 @@ +// language TypeScript +// < definition empty-version . `lib.ts`/ + +export function lib(): string { +// ^^^ definition empty-version . `lib.ts`/lib(). + return '' +} + diff --git a/src/ScipSymbol.ts b/src/ScipSymbol.ts index 9d8d75a0..a52d4a62 100644 --- a/src/ScipSymbol.ts +++ b/src/ScipSymbol.ts @@ -24,7 +24,11 @@ export class ScipSymbol { } public static package(name: string, version: string): ScipSymbol { - return new ScipSymbol(`scip-typescript npm ${name} ${version} `) + // SCIP spells an empty package field as `.`, because a double space is an + // escaped space. + return new ScipSymbol( + `scip-typescript npm ${name || '.'} ${version || '.'} ` + ) } public static anonymousPackage(): ScipSymbol {