- the docs for `clean` don't seem to have been updated with f15cb84dcc99a0bd20f3afce101c0991683010b6, which slightly changed how it works
- also clarify that "wipes out cache" means it deletes _all_ previous caches by saying "wipes any existing cache" instead
- fix the `include` default explanation to mention `.tsx` files as well, since the regex includes those
- also add code backticks and capitalize TypeScript etc (guess I missed this option in my previous PRs? or I intentionally left it as a separate change a while ago...)
- also add code backticks around `node_modules` in `cacheRoot` as well while at it
- use non-rendered newlines between sentences for markdown style consistency
- as the `alexlur` fork no longer exists / 404s, permalink back to og rpt
- which is archived and still exists under the `rollup` org
- as requested in issues
- it's already been supported since eb1dd17babde0b22e9540b12e671eb56d9d6bce0, but the docs and error message were not updated to mention it
- so add both to make sure users aren't confused
- also re-order it to be ES2015, ES2020, then ESNext consistently, which is their module order (c.f. https://github.com/microsoft/TypeScript/issues/24082)
- modify test to account for the new error message
- make it a bit more resilient to change by only testing a substring as well (c.f. https://jestjs.io/docs/expect#tothrowerror)
- improve grammar in several places
- mostly add "the" and commas in several places where they were missing
- and put a period or semicolon in a few places where there was a comma splice
- for "deep merge", parens were used, whereas a colon is a better fit
- consistently use "(see #x)", instead of sometimes using parens and other times using commas
- also change "only if `useTsconfigDeclarationDir`" to "unless `useTsconfigDeclarationDir`" for clarity
- have looked at this many times and thought something was unintuitive about this: `useTsconfigDeclarationDir` defaults to `false` after all
- "typescript" -> "TypeScript" as a proper noun
- "js" -> "JS" similarly
- "es6" -> "ES6"
- "rollup" -> "Rollup"
- "rollup watch" -> "Rollup's watch mode"
- "work directory" -> "working directory" (that's what the "w" stands for)
- improve formatting in several places
- split up paragraphs a bit more neatly as a single new line in Markdown is just rendered as a space
- similar to my previous commit for `emitDeclarationOnly`
- and apparently I missed two sentences in the "Declarations" section there too
- for `tsconfig`, `objectHashIgnoreUnknownHack`, and `typescript`, actually add a double new line
- to break up the paragraph for better rendered readability
- don't skip heading level for "Some compiler options" -- this should be an h3, not an h4
- remove inconsistent period in one of the headings as well (and headings aren't normally supposed to have periods)
- consistently use backticks when referencing plugin, `tsconfig` options, etc
- e.g. `tsconfig`, `include`, `exclude`, `node_modules`, etc
- also, for `allowJs`, put the proper `**/node_modules/**/*` `exclude` as an example similar to the `**/*.js+(|x)`
- as plain `node_modules` won't work as I've recently found out
- consistently use 1 tab indent for plugin options' descriptions, instead of a few 2 tab indents
- for "Requirements" section, use bullets instead having everything on one line
- the way it was written seemed like they were intended to be on different lines, but a single new line in Markdown is just rendered as a space (per above)
- bullets are a little better than just new lines as well
- add TSConfig Reference links to several `tsconfig` options mentions
- `extends`, `declarationDir`, `declaration`, `declarationMap`, and `emitDeclarationOnly`
- also added the mention of `extends` in "chaining tsconfigs"
* docs/clean: formally deprecate `rollupCommonJSResolveHack`
- this has had no effect since 6fb0e75f5328666dca8ff7b11bc956096351a3eb, released in 0.30.0
- that changed the code to always return OS native paths via the NodeJS Path API
- so setting `rollupCommonJSResolveHack` would make no difference either `true` or `false`
- effectively, it's as if it's always `true` now
- formally state now that this is deprecated in the docs
- as well as when that occurred and what it means
- also add a warning in `options` similar to the existing one for `objectHashIgnoreUnknownHack`
- remove the `resolve` dependency as well
- it turns out something in the devDeps still uses it, so it didn't get fully removed in the `package-lock.json`
- `resolve` was never needed anyway as we could've used NodeJS's native `path.resolve` or `require.resolve` instead
- `resolve` was created for `browserify` after all, where one can't use NodeJS APIs
- but we run on NodeJS and can and already do use NodeJS APIs, including both `path.resolve` _and_ `require.resolve`
- I actually started this commit just to remove the dep, then realized the entire code path is obsolete
* fix lint error -- resolved can now be const
- when `emitDeclarationOnly` is set, only perform type-checking and emit declarations, don't transform TS
- `result.code` actually doesn't exist when `emitDeclarationOnly` is set anyway
- this caused a confusing situation for users who were trying to use Babel (with Babel plugins) on TS and only use rpt2 for declarations
- instead of getting any JS code, they would just get empty chunks, bc `result.code` is `undefined`
- that's kind of buggy, it should probably either be forced to `false` or do what we're doing now, which is likely more intuitive / intended
- so now, instead of getting an empty chunk, rpt2 will just pass to the next plugin, allowing for other plugins on the chain to process TS
- this opens up some new use cases, like using in tandem with Babel plugins (as the issue illustrates) or using for type-checking and declaration generation while using Vite / ESBuild for compilation
- add a new paragraph to "Declarations" docs about this new feature and what it does and some examples of how it could be used
- note that these are unexplored / untested integrations, so point that out in the docs too
- also modify a self-reference further up in the docs to use code backticks for `rollup-plugin-typescript2`
- while at it, also add a line about declaration maps
- and reformat the existing paragraph a bit to match the style and improve readability
- one sentence per line, which is all on the same paragraph in Markdown anyway
- add a `<br />` element to add a new-line _within_ the paragraph for better readability / spacing
- Markdown supports this only with two trailing spaces, which is difficult to see and the trailing whitespace can be trimmed by editors, so prefer `<br />`
- `noEmitOnError: true` acts like `noEmit: true` when there is an error
- this is problematic because it will then cause _all_ files to have
`emitSkipped` set to `true`, which this plugin interprets as a fatal
error
- meaning it will treat the first file it finds as having a fatal
error and then abort, but possibly without outputting any
diagnostics what-so-ever as the file with the error in it may not
yet have run through the `transform` hook
- i.e. an initial file that imports an erroring file at some point
in its import chain will cause rpt2 to abort, even if that
initial file _itself_ has no type-check/diagnostic issues
- bc TS does whole-program analysis after all
- this has only been reported as an issue once so far, probably because
it defaults to `false` in TS and, as such, is rarely used:
https://www.typescriptlang.org/tsconfig#noEmitOnError
- we usually have the opposite issue, people trying to set it to
`false` (i.e. the default) because they don't realize the
`abortOnError` option exists
- add `noEmitOnError: false` to the forced options list and tests too
- add it to the docs on what tsconfig options are forced
- and add a reference to the issue like the existing options
- also reference `abortOnError` since they're commonly associated with
each other and that plugin option is often missed (per above)
- briefly explain that `noEmit` and `noEmitOnError` are `false` because
Rollup controls emit settings in the context of this plugin, instead
of `tsc` etc
- should probably watch out for when new emit settings are added to
TS, as we may want to force most with the same reasoning
* docs: split off a CONTRIBUTING.md from the README
- condenses the README a bit and uses the standard CONTRIBUTING.md file
- it's a file I often look for when filing an issue or creating a PR
- leaves the section still in the README so that users (esp. on NPM)
will know to go there if they're not aware of that convention
- GitHub also now tells users to read the CONTRIBUTING.md of a repo when
filing issues or creating PRs, so hopefully this helps point more
users in the right direction as well
* docs: improve formatting, grammar, and links in CONTRIBUTING.md
- slightly change reference to GH Issue Tracker
- use oxford commas everywhere for clarity
- missing "the" in a few places
- more minor grammatical fixes (missing space, semicolon vs. comma, etc)
- fix: "npm_modules" -> "`node_modules`"
- fix: "npm lint" -> "npm run lint", "npm build" -> "npm run build",
"npm build-self" -> "npm run build-self"
- short-hand works in Yarn and for some pre-defined Node scripts, like
`start` and `test`, but the rest need `run`
- "typescript" -> "TS" (prefer proper "TypeScript" or just "TS")
- use backticks monospace/code formatting where appropriate
- link to GitHub's official docs on forking and making PRs
- also use the word "standard" instead of "normal" as it's more
inclusive and reflective that this is a convention/standard
- link to editorconfig site
- link directly to `.editorconfig` with a relative link as well
- reword portion about PR checks as they do run `build` and `build-self`
nowadays (not sure how old this text is)
- use an ordered list (instead of unordered) for the testing process
as this is meant to be done in order
- "latest 2.x" is no longer accurate and quite outdated (we're on 4.x
now), so just say it's the peerDep instead
- @rollup/plugin-typescript calls the default a peerDep too:
https://github.com/rollup/plugins/tree/master/packages/typescript#typescript
- be more specific that you can pass in a different version or fork of
TS (like `ttypescript`) through this option
- follow-up to 8ec49c78f523687deaf6816bc2ea320f16e325c7
- auto-trim some whitespace-only lines
- my editor does this automatically, and most of the README has
trimmed whitespace anyway, so this keeps it consistent
- `rollup-plugin-` -> `@rollup/plugin-`
- just less confusion for newer users who may not be aware of the
previous naming. and up-to-date / current naming anyway
- clarify grammar in `@rollup/plugin-babel` to be a bit more specific
- remove part about what "it claims", no need for negative tone
- add a link to the Babel plugin's docs for its default extensions
- comment out ellipsis in code samples (closer to valid code)
- fix: missing `#` in `outDir` reference ("83")
- use `org/repo#num` consistently
- previously was `Microsoft/TypeScript/issues/num` or
`rollup/issues/num` inconsistently
- this is how GitHub displays references to other repos in comments as
well, so consistent with the rest of GH too
- links haven't changed, just the text of the them
- auto-trim some whitespace-only lines
- my editor does this automatically, and most of the README has
trimmed whitespace anyway, so this keeps it consistent
- previously it just linked to the image itself; better to link to the
source of the stats which is NPM
- duplicates the other badge's link, but nbd, better than linking to
an image imo
- it's a deep merge that merges them by index
- the rest of the docs are accurate, just this one mention was incorrect
- eventually should move to shallow merge/replace arrays to better
reflect how `tsconfig` `extends` works, but just fix the docs for now
- previously, declarationDir was set to cwd if useTsconfigDeclarationDir
wasn't true, however, declarations aren't output to cwd, but to
Rollup's output destination, so this was incorrect
- instead, don't set declarationDir, which defaults it to outDir,
which is currently set to a placeholder
- previously, it rewrote declarations to output to Rollup's dest
from cwd, now rewrite from outDir placeholder instead
- and add a rewrite of sources to match relative path from Rollup's
output dest instead of outDir placeholder
- also change the one line in the docs that says it'll be
`process.cwd()`; every other reference says it'll be the output dest
- so remove that reference to objectHashIgnoreUnknownHack
- also be more specific about what cases objectHashIgnoreUnknownHack
might be needed for
- asyncgeneratorfunctions are still one off the top of my head, but
there are certainly others it just won't know about, including
future syntaxes