fix: only publish src directory when something references it - #506
Merged
Conversation
The declaration maps point at `/src/`, but that directory was added to the `.npmignore` unless JS source maps were enabled, so every package built with `declarationMap` shipped maps that resolve to nothing and "go to definition" landed nowhere. Default `declarationMap` to `false` and publish `/src/` when it's turned on. The test files in that directory are now excluded individually, which they never were when JS source maps published it. Closes denoland#400 Closes denoland#413
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #400
Closes #413
Problem
.npmignoredecided whether to exclude/src/based on JS source maps only — declaration maps were never considered. SincedeclarationMapdefaulted totruewheneverdeclarationwas enabled andskipSourceOutputwasfalse, the default build published.d.ts.mapfiles pointing at../src/foo.tswhile.npmignorecontained/src/:Editors follow those maps, find nothing, and "go to definition" lands nowhere — the report in #400.
inlineSourcesdoes not help: it embedssourcesContentin the JS source map only, never in a.d.ts.map.This started when
declarationMapbecame default-on in b5f0a23 (0.41.0); #400 was filed six weeks later.The
.jsmodule specifiers both issues point at are not the problem —./dom.jsin a.d.tsresolves todom.d.ts, andnpm/srctype checks clean undernode16,nodenext, andbundler.Fix
declarationMapnow defaults tofalse, and is ignored (with a warning) whendeclarationis disabled orskipSourceOutputis on, since the maps have nothing to point at./src/is published so they resolve./src/are now excluded individually. They were never listed, so anyone usingsourceMap: true(which already published/src/) was shipping their test sources and test shims.Verification
Building a package with
declarationMap: trueand installing it:and with the default config, no
.d.ts.mapfiles are emitted and/src/stays ignored.deno test -Apasses. Integration coverage added for both the new default and thedeclarationMap: truepath.