90 Commits

Author SHA1 Message Date
Eugene Zolenko
59817c4ef6
- enabling ES2022 module (#450) 2023-06-19 23:10:11 -06:00
Anton Gilgur
e5e3ccd793
docs: clarify clean: true and default include (#387)
- 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
2022-07-21 12:15:59 -06:00
Anton Gilgur
21549dcd8f
docs: mention transpileOnly in check: false (#378)
- this is a common name in other TS integrations and has been mentioned in the issues before
  - so add it in the docs for searchability
2022-07-12 09:53:47 -06:00
Anton Gilgur
abbd194ebf
docs: add a permalink to the og rpt (#380)
- 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
2022-07-12 09:53:27 -06:00
Anton Gilgur
9e7adaa2e2
docs: mention ttypescript, a common integration (#379)
- `ttypescript` is commonly used for `transformers` and is referenced various times in the issues
  - so add it to the docs for searchability
2022-07-12 09:53:04 -06:00
Anton Gilgur
9c508989b8
docs: mention module: "ES2020" compatibility (#376)
- 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)
2022-07-05 22:11:14 -06:00
Anton Gilgur
8f659a9cae
docs: improve grammar & formatting, plus add TSConfig Reference links (#375)
- 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"
2022-07-05 21:54:21 -06:00
Anton Gilgur
74f6761ff6
docs/clean: formally deprecate rollupCommonJSResolveHack (#367)
* 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
2022-06-24 10:30:32 -06:00
Anton Gilgur
4ea7f10c24
feat: support emitDeclarationOnly (#366)
- 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 />`
2022-06-24 10:25:26 -06:00
Anton Gilgur
b44b069cb2
fix: force noEmitOnError: false (#338)
- `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
2022-06-01 14:42:46 -06:00
Anton Gilgur
e28d2f08b9
docs: split off a CONTRIBUTING.md and improve formatting, grammar, links (#313)
* 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
2022-05-05 09:25:43 -06:00
Anton Gilgur
462442d6f5
docs: clarify the TS option's defaults (#316)
- "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
2022-05-04 10:16:45 -06:00
Anton Gilgur
971c816bea
docs: update Compatibility section with new names and links (#315)
- `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)
2022-05-04 10:12:47 -06:00
Anton Gilgur
00bf86f156
docs: standardize how issues are referenced (#317)
- 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
2022-05-04 10:09:38 -06:00
Anton Gilgur
c219228dd6
docs: add link to NPM in monthly downloads badge (#318)
- 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
2022-05-04 10:08:27 -06:00
Anton Gilgur
e4b5880aa6
fix(docs): _.merge doesn't concat arrays (#314)
- 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
2022-05-04 10:07:48 -06:00
Eugene Zolenko
4e9f8fff08
- cleaning up badges 2022-02-01 16:54:38 -07:00
Eugene Zolenko
d8c4cccb33
Update README.md 2021-02-19 10:14:10 -07:00
Eugene Zolenko
8ec49c78f5
Update README.md
#252
2021-01-20 13:31:10 -07:00
Brandon Chinn
91846974dc
Add tslib to installation instructions (#253)
* Add tslib to installation instructions for yarn
2020-11-25 12:56:30 -07:00
Anton Gilgur
ec0568ba2c (fix): declaration maps should have correct sources
- 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
2020-09-30 19:46:37 -04:00
Eugene Zolenko
039bac46ec
CI status badge 2020-03-27 00:07:51 -06:00
Anton Gilgur
0caa1c427f
(docs): async plugins are now supported out-of-the-box (#205)
- 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
2020-02-13 16:42:04 -07:00
Eugene Zolenko
7fd52b7210 - updating readme 2020-02-11 16:10:17 -07:00
chocolateboy
947da2523c Fix syntax error in transformer example (#195) 2019-12-04 15:15:55 -07:00
chencheng (云谦)
4217346054 feat: support options.cwd (#197) 2019-12-03 10:20:41 -07:00
Eugene Zolenko
d6359af2b0
Update README.md 2019-11-13 18:42:51 -07:00
Eugene Zolenko
bc5b419c79 - merging #190
- readme and tslint updates
2019-11-05 10:34:39 -07:00
Eugene Zolenko
330a0ce804 - reverting #181 2019-10-29 15:28:06 -06:00
Eugene Zolenko
6cfddd4f74 - updating package.json for minimum rollup version
- readme
- fix for linter warnings
- package version
2019-10-28 10:51:27 -06:00
Eugene Zolenko
c20a19fe34 - updating readme and package version 2019-10-28 10:30:50 -06:00
Eugene Zolenko
07d9a9c0dc
Update README.md 2019-09-05 15:14:14 -06:00
Nick McCurdy
ffda2e539b Move cache directory to node_modules (#167)
* Move cache directory to node_modules

* Use find-cache-dir to find .cache in node_modules
2019-08-28 17:26:05 -06:00
EqualMa
1404c73a64 Fix extension name in babel config (#158)
An extension name should start with a `.` in the `extensions` option of babel config. (As described here: https://babeljs.io/docs/en/babel-core#default-extensions)
2019-07-02 10:29:16 -06:00
Eugene Zolenko
313684c1da
Update README.md 2019-06-11 10:23:24 -06:00
Eugene Zolenko
1c3a093bcb
- removing extra options from babel plugin example
#108
2019-05-13 09:47:50 -06:00
Eugene Zolenko
6053494f60
- removing unresponsive badge 2019-05-10 15:11:05 -06:00
Eugene Zolenko
28ae2ccff7
Documenting workaround for #108 2019-05-10 15:10:19 -06:00
ezolenko
518c8860b7 - updating readme #143 2019-03-13 09:02:25 -06:00
Eugene Zolenko
ec8f9099d6
Clarifying readme
#66
2019-01-15 13:33:59 -07:00
Eugene Zolenko
6b0225a7de - redoing switch to generateBundle (#126 #127 #128)
- using rollup's own types
- min rollup bumped to 0.68
- updating dependencies
- package version 0.19
2019-01-04 15:52:31 -07:00
Eugene Zolenko
7d6dd466f5
Contributing section in readme 2019-01-04 10:42:14 -07:00
Eugene Zolenko
3a6079c1ec - using allowNonTsExtensions to let other plugins generate typescript #111 2018-10-30 10:23:22 -06:00
Luca Ban
4d8c85f098 Add installation (#116) 2018-09-27 11:28:04 -06:00
Eugene Zolenko
3b46e8d599 - object-hash hack optional #105 2018-08-14 11:01:28 -06:00
Eugene Zolenko
b2cb064766
- updating libraries.io shield 2018-07-30 10:29:58 -06:00
Eugene Zolenko
0462d1d0f2
- switching dependencies shield to libraries.io 2018-07-23 14:31:13 -06:00
Eugene Zolenko
e3a382fad0
- reducing shields maxage 2018-07-20 10:11:50 -06:00
Eugene Zolenko
fe0490c807 - attempting to achieve line ending sanity 2018-07-05 14:59:54 -06:00
Eugene Zolenko
c86e07bc0f - fix for invisible declaration files, #95 2018-07-05 14:39:45 -06:00