From f96f167dc8cc733b43d67801f568b2d546bc2fb9 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 21 Mar 2024 14:42:23 -0700 Subject: feat(unstable/publish): error when a package's module is excluded from publishing (#22948) Closes #22657 --- tests/specs/jsr/excluded_export_module/__test__.jsonc | 7 +++++++ tests/specs/jsr/excluded_export_module/deno.json | 12 ++++++++++++ .../specs/jsr/excluded_export_module/excluded_file1.ts | 0 .../specs/jsr/excluded_export_module/excluded_file2.ts | 0 tests/specs/jsr/excluded_export_module/main.ts | 2 ++ .../not_imported_excluded_file.ts | 0 tests/specs/jsr/excluded_export_module/publish.out | 18 ++++++++++++++++++ 7 files changed, 39 insertions(+) create mode 100644 tests/specs/jsr/excluded_export_module/__test__.jsonc create mode 100644 tests/specs/jsr/excluded_export_module/deno.json create mode 100644 tests/specs/jsr/excluded_export_module/excluded_file1.ts create mode 100644 tests/specs/jsr/excluded_export_module/excluded_file2.ts create mode 100644 tests/specs/jsr/excluded_export_module/main.ts create mode 100644 tests/specs/jsr/excluded_export_module/not_imported_excluded_file.ts create mode 100644 tests/specs/jsr/excluded_export_module/publish.out (limited to 'tests') diff --git a/tests/specs/jsr/excluded_export_module/__test__.jsonc b/tests/specs/jsr/excluded_export_module/__test__.jsonc new file mode 100644 index 000000000..2ff51f507 --- /dev/null +++ b/tests/specs/jsr/excluded_export_module/__test__.jsonc @@ -0,0 +1,7 @@ +// test for a module that's excluded from being +// published, but is found in the module graph +{ + "args": "publish --dry-run", + "output": "publish.out", + "exitCode": 1 +} diff --git a/tests/specs/jsr/excluded_export_module/deno.json b/tests/specs/jsr/excluded_export_module/deno.json new file mode 100644 index 000000000..1254582ac --- /dev/null +++ b/tests/specs/jsr/excluded_export_module/deno.json @@ -0,0 +1,12 @@ +{ + "name": "@denotest/excluded-export-module", + "version": "0.1.0", + "exports": "./main.ts", + "publish": { + "exclude": [ + "./excluded_file1.ts", + "./excluded_file2.ts", + "./not_imported_excluded_file.ts" + ] + } +} diff --git a/tests/specs/jsr/excluded_export_module/excluded_file1.ts b/tests/specs/jsr/excluded_export_module/excluded_file1.ts new file mode 100644 index 000000000..e69de29bb diff --git a/tests/specs/jsr/excluded_export_module/excluded_file2.ts b/tests/specs/jsr/excluded_export_module/excluded_file2.ts new file mode 100644 index 000000000..e69de29bb diff --git a/tests/specs/jsr/excluded_export_module/main.ts b/tests/specs/jsr/excluded_export_module/main.ts new file mode 100644 index 000000000..69bff30bf --- /dev/null +++ b/tests/specs/jsr/excluded_export_module/main.ts @@ -0,0 +1,2 @@ +import "./excluded_file1.ts"; +import "./excluded_file2.ts"; diff --git a/tests/specs/jsr/excluded_export_module/not_imported_excluded_file.ts b/tests/specs/jsr/excluded_export_module/not_imported_excluded_file.ts new file mode 100644 index 000000000..e69de29bb diff --git a/tests/specs/jsr/excluded_export_module/publish.out b/tests/specs/jsr/excluded_export_module/publish.out new file mode 100644 index 000000000..bcf94e521 --- /dev/null +++ b/tests/specs/jsr/excluded_export_module/publish.out @@ -0,0 +1,18 @@ +Check file:///[WILDLINE]/main.ts +Checking for slow types in the public API... +Check file:///[WILDLINE]/main.ts +error[excluded-module]: module in package's module graph was excluded from publishing + --> [WILDLINE]excluded_file1.ts + = hint: remove the module from 'exclude' and/or 'publish.exclude' in the config file + + info: excluded modules referenced via a package export will error at runtime due to not existing in the package + docs: https://jsr.io/go/excluded-module + +error[excluded-module]: module in package's module graph was excluded from publishing + --> [WILDLINE]excluded_file2.ts + = hint: remove the module from 'exclude' and/or 'publish.exclude' in the config file + + info: excluded modules referenced via a package export will error at runtime due to not existing in the package + docs: https://jsr.io/go/excluded-module + +error: Found 2 problems -- cgit v1.2.3