Skip to content

Releases: zspecza/common-tags

v1.8.2

16 Nov 20:14
Compare
Choose a tag to compare

This release is based on the same code that v1.8.1, but it fixes a regression caused by forgetting to run the build before publishing. Thanks @alumni for the hint!

v1.8.1: The "anti-takeover" one

11 Nov 19:04
Compare
Choose a tag to compare

The creator of the package changed the handle from declandewet to zspecza, and for a while GitHub was redirecting from the old repo to the new one. This changed with the "takeover" of the original user handle by a random person, and so in this release all the links in package.json are updated to include the new handle.

The next step!

20 Jan 22:24
Compare
Choose a tag to compare
The next step! Pre-release
Pre-release

This is a pre-release. Please help the development of common-tags by testing the common-tags@next version.

Version 2.0.0 is coming. Before it is released however, there are some things to be done - eg. the documentation needs to be rewritten properly for clarity. Maybe the package will be also rewritten into TypeScript? Who knows.

Breaking changes

  • TemplateTag no longer detects whether the argument is a function and subsequently calls it. This may have been a bit convenient, but at the cost of code clarity, and it was also adding extra complication to the core function that should be as lean as possible: (declandewet/common-tags@0c1c971)
  • Arguments in transformers are now checked on initialization as opposed to inside the hooks. This makes errors detectable earlier (declandewet/common-tags@1811baa)

New stuff

  • createTag is introduced as a replacement for TemplateTag. The days of adding new each time you want to combine some tags are over (declandewet/common-tags@74d1076)
  • Each of the hooks (onString, onSubstitution, onEndResult) now gets and additional argument: context. You can initialize its value in the new getInitialContext hook. This replaces the previously suggested practice of doing something like assigning to this in a hook. For more insight I recommend reading the tests in the linked commit (declandewet/common-tags@c17c2f0)
  • A new tag is added: id. It just returns whatever it receives. Again, for more examples for now look into tests in the following commit (declandewet/common-tags@52120bb)
  • Tags are now composable; previously this feat was impossible, as tags are functions and would've just been called. After the breaking change you can stuff other tags inside createTag without a problem (declandewet/common-tags@e393195)
  • Smart trimming was introduced as a remedy to a long-standing issue and is now used in stripIndent and stripIndents (https://github.com/declandewet/common-tags/pull/165)
  • Nesting code inside other code when using html (aka source aka codeBlock`) should not cause nasty surprises anymore (https://github.com/declandewet/common-tags/pull/182)

Deprecations

  • As a result of the introduction of createTag, TemplateTag is now soft-deprecated. That means you can still use it, but it will print a helpful message that will guide you to the new API (declandewet/common-tags@3ad1946)

v1.8.0

27 May 15:26
Compare
Choose a tag to compare

Bug Fixes

  • Previously valueOf was called on objects in templates before toString - now the order is in line with the spec (#144)

Plumbing

  • babel-plugin-transform-runtime was removed as a dependency and as a result babel-runtime is not necessary to use common-tags any more (that means common-tags is dependency-free!) (#148)
  • common-tags is now rolling up into a neat bundle that you can get at unpkg. This makes it even easier to get started with this library! (#150)
  • Dev dependencies were updated (no changes to the actual code) (#149)

v1.8.0-rc.1

27 May 15:19
Compare
Choose a tag to compare
v1.8.0-rc.1 Pre-release
Pre-release

This was a test release to check if common-tags will register properly with unpkg.com.

v1.7.2

11 Jan 05:01
Compare
Choose a tag to compare

No major changes in this release, we just migrated from the AVA test runner to Jest, which has mitigated some issues with our CI pipeline speeds and removed some hard to maintain configs.

v1.7.1

10 Jan 12:55
Compare
Choose a tag to compare

Patches

We've migrated from StandardJS formatting to Prettier's automatic code formatting as well as the recommended ESLint rules. Big props to @fatfisz on this release 🎊

v1.7.0

09 Jan 15:34
Compare
Choose a tag to compare

New Features

onString

onString - transformers now accept an onString method which runs on each part of the template literal that is not marked as a substitution (i.e. not inside "${}").

replaceStringTransformer

replaceStringTransformer(replaceWhat, replaceWith)

Replaces the result of all strings (what's not in ${ ... }) with a new value. Same as for replaceResultTransformer, replaceWhat can be a string or regular expression and replaceWith is the new value.

v1.6.0

21 Dec 20:01
Compare
Choose a tag to compare

New Features

  • using tags on regular string literals is now supported (#132)

Chores

  • stripIndentTransformer was touched up so now the regular expressions (and the behavior) is more consistent across all the tags - thanks @thepheer!
  • the docs were improved and now we have a nice logo!

v1.5.1

24 Nov 09:45
Compare
Choose a tag to compare

Fixes

  • stripIndents preserves empty lines as before (#129)