Giter Club home page Giter Club logo

common-tags's People

Contributors

albkn avatar cdcorey avatar do7be avatar eduard-malakhov avatar fatfisz avatar feross avatar greenkeeper[bot] avatar greenkeeperio-bot avatar hjdivad avatar ibrahima avatar jakeweary avatar jkillian avatar josephfrazier avatar k15a avatar kamilogorek avatar lucianbuzzo avatar shannonmoeller avatar skolmer avatar zspecza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

common-tags's Issues

An in-range update of babel-register is breaking the build 🚨

Version 6.24.0 of babel-register just got published.

Branch Build failing 🚨
Dependency babel-register
Current Version 6.23.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-register is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ bitHound - Dependencies 2 failing dependencies. Details

  • βœ… bitHound - Code No failing files. Details

  • βœ… continuous-integration/travis-ci/push The Travis CI build passed Details

  • βœ… continuous-integration/appveyor/branch AppVeyor build succeeded Details

  • βœ… codecov/patch Coverage not affected when comparing f651e9d...fce9043 Details

  • βœ… codecov/project 100% remains the same compared to f651e9d Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Feature Proposal: Use a tag as a transformer plugin

It's possible to use a template tag as a transformer by latching on to it's transformers property so we can effectively do this:

import {TemplateTag, stripIndent} from 'common-tags'

const upcaseTransformer = () => ({
  onEndResult (endResult) {
    return endResult.toUpperCase()
  }
})

// focus less on the implementation, more on how we're passing `stripIndent` as if it were
// a transformer plugin
const upcase = new TemplateTag(stripIndent, upcaseTransformer)

An in-range update of micromatch is breaking the build 🚨

Version 2.3.11 of micromatch just got published.

Branch Build failing 🚨
Dependency micromatch
Current Version 2.3.10
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As micromatch is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/appveyor/branch Waiting for AppVeyor build to complete Details

  • βœ… continuous-integration/travis-ci/push The Travis CI build passed Details

  • βœ… bitHound - Code No failing files. Details

  • ❌ bitHound - Dependencies 1 failing dependency. Details

Commits

The new version differs by 3 commits .

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Fix inconsistency in README: Code example for inlineArray uses Serial Comma, actual output is Non-Serial

https://github.com/declandewet/common-tags#commalistsand

^ shows the output
I like apples, bananas, and watermelons

Actual output
I like apples, bananas and watermelons

I'm not sure which you're intending to be the correct behavior.

Related:
If you do support Oxford comma, then you need to support:

"Foo and bar"
The current inline transformer with separator and conjunction options looks like it would only handle:
"Foo, and bar" with a comma.

stripIndent with stripIndent'ed string inside doesn't strip some indents

Test case:

const stripIndent = require('common-tags').stripIndent;

const line1 = stripIndent`
    line1.0
    line1.1`;

console.log(line1);

const line2 = stripIndent`
    ${line1}
    line2.0`;

console.log(line2);

Output:

line1.0
line1.1
line1.0
line1.1
    line2.0

As you see, line2.0 isn't de-indented. I'm not sure if it's expected behaviour. If so, how can I achieve desired effect? Thanks for nice lib!

An in-range update of when is breaking the build 🚨

Version 3.7.8 of when just got published.

Branch Build failing 🚨
Dependency when
Current Version 3.7.7
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As when is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/appveyor/branch Waiting for AppVeyor build to complete Details

  • ❌ continuous-integration/travis-ci/push The Travis CI build is in progress Details

  • ❌ bitHound - Dependencies 2 failing dependencies. Details

  • βœ… bitHound - Code No failing files. Details

Release Notes 3.7.8: Unhandled rejection fixes
  • Fix unhandled rejection false positive in settle
  • Fix unhandled rejection events on IE
  • Make build work on Windows
Commits

The new version differs by 9 commits .

  • 5c0a9eb release: 3.7.8
  • 0768dd8 Emit unhandledRejection on Internet Explorer (+ fixes on Windows) (#496)
  • facc6ba Fix unhandled rejection warnings in when.settle (#493) (#494)
  • 8a7785a Make sure MutationObserver is used in Safari as well (#488)
  • f9fa814 Merge pull request #485 from iamstolis/microtime-dependency
  • 9cbecad Updating microtime dependency (so that microtime installs on Node 4 and 5)
  • 2fff98c Enabling Node 4 and 5 on Travis
  • ade6393 Merge pull request #480 from stevage/patch-2
  • 3d2b25f Correct promise.tap "equivalent" explanation

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of babel-plugin-transform-runtime is breaking the build 🚨

Version 6.15.0 of babel-plugin-transform-runtime just got published.

Branch Build failing 🚨
Dependency babel-plugin-transform-runtime
Current Version 6.12.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-plugin-transform-runtime is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • βœ… bitHound - Code No failing files. Details

  • βœ… bitHound - Dependencies No failing dependencies. Details

  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Additional option: indent inserted content

Arrays are nicely indented:

html`
    <ul>
        ${['foo', 'bar'].map(x => `<li>${x}</li>`)}
    </ul>
    `

The output is:

<ul>
    <li>foo</li>
    <li>bar</li>
</ul>

Occasionally, one may insert chunks of text, not Arrays. Then it’d be great to have the option of indenting text after line breaks. In other words, the following code should produce the same output as the previous code:

html`
    <ul>
        ${'<li>foo</li>\n<li>bar</li>'}
    </ul>
    `

1.5.0 breaking changes

stripIndents now replaces multiple newlines with a single one.

console.log(stripIndents`
a
b

c
`);

1.4.0 output:

a
b

c

1.5.0 output:

a
b
c

More generic name for `html` tag?

I came across this library via 2ality. Thanks for this great collection of problem solvers!

My main use is for the html tag - but my template contains JavaScript source code, not HTML. In fact the html tag is pretty useful while generating any block-structured code with correct indenting.

It looks a little strange and not so self-documenting to see JavaScript source inside a html tagged template. At present I just import it using something like import {html as js} from 'common-tags', but it also looks a bit odd seeing html there.

So, I was wondering if this tag could have a more generic name (or at least an alias) exported from the library itself?

use jsnext:main to expose modern JS syntax, pre-babel for 4.x

More information: https://github.com/rollup/rollup/wiki/jsnext:main

And then anyone doing a normal Node.js require, say in 4.x, would no longer be forced into loading babel-runtime into their production processes.

I was just about to recommend this library to my network, but that runtime dependency is a deal-breaker.

Really, I'd recommend that you babel down to lowest common denominator (ES5) to make it easier for users to webpack their components. The standard webpack/babel configuration excludes node_modules: https://github.com/babel/babel-loader#usage

An in-range update of regenerator-runtime is breaking the build 🚨

Version 0.10.2 of regenerator-runtime just got published.

Branch Build failing 🚨
Dependency regenerator-runtime
Current Version 0.10.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As regenerator-runtime is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build is in progress Details

  • ❌ continuous-integration/appveyor/branch Waiting for AppVeyor build to complete Details

  • βœ… bitHound - Code No failing files. Details

  • ❌ bitHound - Dependencies 2 failing dependencies. Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Why the NPM >=3.0.0 requirement?

I just noticed in a stylelint/stylelint Travis CI job the warning:

npm WARN engine [email protected]: wanted: {"node":">=4.0.0","npm":">=3.0.0"} (current: {"node":"4.4.7","npm":"2.15.8"})

In your readme requirements: https://github.com/declandewet/common-tags#requirements πŸ‘

"NPM (v3.0.0+ highly recommended) (this comes with Node.js)"

When NodeJS 4.x is installed with NVM as Travis CI does it does not install the latest NPM 3.x.x branch, the 2.x.x branch is used, you can also see this in your own 4.x Travis job:
β€’ https://travis-ci.org/declandewet/common-tags/jobs/139596870#L123

2.28s$ nvm install 4
Downloading https://nodejs.org/dist/v4.4.5/node-v4.4.5-linux-x64.tar.xz...
######################################################################## 100.0%
Now using node v4.4.5 (npm v2.15.5)
...
$ node --version
v4.4.5
$ npm --version
2.15.5
$ nvm --version
0.31.0
install
8.15s$ npm install 

The NodeJS 5.x branch doesn't have this issue as it uses NPM 3.x for example:
β€’ https://travis-ci.org/declandewet/common-tags/jobs/139596869#L123

NodeJS 4.x.x is the LTS (Long Term Support) NodeJS release: https://github.com/nodejs/LTS/blob/master/README.md

NPM 2.x.x is the LTS NPM release: https://github.com/npm/npm/wiki/Roadmap#tactical-roadmap

So, does common-tags really require NPM 3.x.x? Would you consider removing the 3.x.x requirement? It appears to work fine with common-tags and stylelint using NPM 2.x.x

Post-process output of other tag functions?

Occasionally, it’d be nice if one could dedent the output of another tag function, like this:

stripIndent(String.raw)`
    abcdefg
`;

That could be achieved by making all functions behave differently if the first (and only) parameter is a function.

An in-range update of babel-preset-stage-0 is breaking the build 🚨

Version 6.24.1 of babel-preset-stage-0 just got published.

Branch Build failing 🚨
Dependency babel-preset-stage-0
Current Version 6.22.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-preset-stage-0 is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ bitHound - Dependencies 4 failing dependencies. Details

  • βœ… bitHound - Code No failing files. Details

  • βœ… continuous-integration/travis-ci/push The Travis CI build passed Details

  • βœ… continuous-integration/appveyor/branch AppVeyor build succeeded Details

  • βœ… codecov/project 100% remains the same compared to f651e9d Details

  • βœ… codecov/patch Coverage not affected when comparing f651e9d...66ecec5 Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Strip indent having issues when using something like util.inspect

When I'm including data that was serialized using node's util.inspect function, stripIndent seems to be making some mistakes on how to handle the indent stripping. Here's the script and the output as an example:

'use strict';
const commonTags = require('common-tags');
const util = require('util');


const obj = {
	prop1: 'asdfasdfasdfsadfasdf asdfasdfasdfsadfasdf',
	prop2: 'asdfasdfasdfsadfasdf asdfasdfasdfsadfasdf',
	shape: {
		prop3: 'asdfasdfasdfsadfasdf asdfasdfasdfsadfasdf',
		prop4: 'asdfasdfasdfsadfasdf asdfasdfasdfsadfasdf'
	}
}

if (true) {
	if (true) {
		console.log(commonTags.stripIndent`
			Some firstline message
			Some secondline message
			${util.inspect(obj)}
		`);
	}
}

Actual output:

Some firstline message
        Some secondline message
        { prop1: 'asdfasdfasdfsadfasdf asdfasdfasdfsadfasdf',
prop2: 'asdfasdfasdfsadfasdf asdfasdfasdfsadfasdf',
shape:
 { prop3: 'asdfasdfasdfsadfasdf asdfasdfasdfsadfasdf',
   prop4: 'asdfasdfasdfsadfasdf asdfasdfasdfsadfasdf' } }
vagrant@dev:/opt/signal (alert-check-update)$ node scratch/data-test.js

Expected output:

Some firstline message
Some secondline message
{ prop1: 'asdfasdfasdfsadfasdf asdfasdfasdfsadfasdf',
  prop2: 'asdfasdfasdfsadfasdf asdfasdfasdfsadfasdf',
  shape:
   { prop3: 'asdfasdfasdfsadfasdf asdfasdfasdfsadfasdf',
     prop4: 'asdfasdfasdfsadfasdf asdfasdfasdfsadfasdf' } }

Generate built files for CDN use

Awesome project here! I had just finished reworking a bunch of examples for Netlify CMS using stripIndent when I realized there's no way to "just use it" via a CDN like unpkg.com. Have you considered providing built files?

An in-range update of babel-preset-latest is breaking the build 🚨

Version 6.24.0 of babel-preset-latest just got published.

Branch Build failing 🚨
Dependency babel-preset-latest
Current Version 6.22.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-preset-latest is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • βœ… bitHound - Code No failing files. Details

  • ❌ bitHound - Dependencies 2 failing dependencies. Details

  • βœ… continuous-integration/travis-ci/push The Travis CI build passed Details

  • βœ… continuous-integration/appveyor/branch AppVeyor build succeeded Details

  • βœ… codecov/patch Coverage not affected when comparing f651e9d...5113446 Details

  • βœ… codecov/project 100% remains the same compared to f651e9d Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Investigate chaining

Being able to chain an infinite amount of tags would be really useful.

It would basically be the same functionality as the tail processing syntax:

tag(otherTag)`some text`

but instead of being limited to one extra tag, you could chain as many as you want

tag.otherTag.thirdTag`some text`

Remove `null` values from `html` output

Currently, the html tag produces invalid markup when a null value is encountered:

import {html} from 'common-tags'

const todos = [{
  task: 'some task',
  done: false
}, {
  task: 'other task',
  done: true
}]

html`
  <h1>Incomplete tasks:</h1>
  <ul>
    ${todos.map((t) => t.done ? null : `<li>${t.task}</li>`)}
  </ul>
`

Produces:

<h1>Incomplete tasks</h1>
<ul>
  <li>some task</li>
  null
</ul>

An in-range update of babel-eslint is breaking the build 🚨

Version 7.1.1 of babel-eslint just got published.

Branch Build failing 🚨
Dependency babel-eslint
Current Version 7.1.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-eslint is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/appveyor/branch Waiting for AppVeyor build to complete Details

  • ❌ continuous-integration/travis-ci/push The Travis CI build is in progress Details

  • ❌ bitHound - Dependencies 1 failing dependency. Details

  • βœ… bitHound - Code No failing files. Details

Commits

The new version differs by 5 commits .

  • bc482f4 7.1.1
  • baeb99b chore(package): update dependencies (#422)
  • 2d587d6 append code frame on parse error (#418)
  • e7c9a03 chore(package): update babylon to version 6.13.0 (#420)
  • 971c8d6 chore(package): update eslint to version 3.9.1 (#419)

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of babel-cli is breaking the build 🚨

Version 6.22.0 of babel-cli just got published.

Branch Build failing 🚨
Dependency babel-cli
Current Version 6.18.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-cli is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • βœ… bitHound - Code No failing files. Details

  • ❌ bitHound - Dependencies 1 failing dependency. Details

  • βœ… continuous-integration/travis-ci/push The Travis CI build passed Details

  • βœ… continuous-integration/appveyor/branch AppVeyor build succeeded Details

  • βœ… codecov/patch Coverage not affected when comparing f651e9d...e7f2d95 Details

  • βœ… codecov/project 100% (+0.00%) compared to f651e9d Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

source tag doubles newlines in certain circumstances

I think there's some kind of issue with interpolation/substitution with the source tag - for instance, if I do something like

const baz = "baz\nquux\ngarply";
source`
  Foo
  Bar

  ${baz}
`

where baz contains newlines, the result will have all the newlines within baz doubled:

Foo
Bar

baz

quux

garply

but I would have expected

Foo
Bar

baz
quux
garply

This only happens if the interpolation is preceded by a newline.

Interestingly, if I do something like

source`${baz}`

the newlines actually get turned into spaces, which is also not what I would have expected.

I think it has something to do with the fact that source blocks attempt to match the outer indentation level when you interpolate a variable? I.e.,

source`
  Foo:
    Bar
    ${baz}
`

becomes

Foo:
  Bar
  baz
  quux
  garply

An in-range update of which is breaking the build 🚨

Version 1.2.13 of which just got published.

Branch Build failing 🚨
Dependency which
Current Version 1.2.12
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As which is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build is in progress Details

  • ❌ continuous-integration/appveyor/branch Waiting for AppVeyor build to complete Details

  • ❌ bitHound - Dependencies 3 failing dependencies. Details

  • βœ… bitHound - Code No failing files. Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of rimraf is breaking the build 🚨

Version 2.6.0 of rimraf just got published.

Branch Build failing 🚨
Dependency rimraf
Current Version 2.5.4
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As rimraf is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build is in progress Details

  • ❌ continuous-integration/appveyor/branch Waiting for AppVeyor build to complete Details

  • ❌ bitHound - Dependencies 2 failing dependencies. Details

  • βœ… bitHound - Code No failing files. Details

Commits

The new version differs by 5 commits .

  • 5b661e4 v2.6.0
  • c09915f update tap
  • d53235d Make rimraf.sync 10000% more reliable on Windows
  • e8b10a7 Retry on EBUSY et al on non-windows platforms as well
  • 0fac5f7 Add --no-glob option to cli

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of which is breaking the build 🚨

Version 1.2.12 of which just got published.

Branch Build failing 🚨
Dependency which
Current Version 1.2.11
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As which is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • βœ… bitHound - Code No failing files. Details

  • βœ… bitHound - Dependencies No failing dependencies. Details

  • ❌ continuous-integration/travis-ci/push The Travis CI build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Source map error in common-tags when building with webpack

I feel a little bad posting this here, I'm not 100% convinced that common-tags is the problem, but it's the top of the stack trace, so here goes...

Occasionally our webpack build will start giving the following error:

 ERROR in ./node_modules/common-tags/lib/oneLine/index.js
    Module build failed: Error: /Users/joe/Code/lendinghome-treefuls/feature-1/node_modules/common-tags/lib/oneLine/index.js: original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.
        at SourceMapGenerator_validateMapping [as _validateMapping] (/Users/joe/Code/lendinghome-treefuls/feature-1/client/src/monopack/node_modules/source-map/lib/source-map-generator.js:276:15)
        at SourceMapGenerator_addMapping [as addMapping] (/Users/joe/Code/lendinghome-treefuls/feature-1/client/src/monopack/node_modules/source-map/lib/source-map-generator.js:110:12)
        at /Users/joe/Code/lendinghome-treefuls/feature-1/client/src/monopack/node_modules/babel-core/lib/transformation/file/index.js:467:27

It happens with or without, hot module reload enabled and in between builds without ANY changes to node modules. The only solution is to remove all node_modules folders and try again. This happens at least three or four times a day to multiple devs on our team.

The only reason I'm suspicious of this library is because if I remove all uses of the oneLine tag, everything works again. Once I revert that change, it breaks immediately. I've googled it, and it seems like lot's of people run into this error with various libs (see mozilla/source-map#304, webpack/webpack-sources#28 and webpack/webpack#6131). We do not use the libraries listed in these issues.

I don't have the time right now, but I'll try to see if I can reproduce this in a separate repo. I'm posting this right now to gather data and see if anyone has this issue with common-tags in the stack trace. Or maybe if the maintainers here have any thoughts on whether or not this library is the root cause.

Thanks!

EDIT: Thought I'd add that our app is being transpiled with babel-runtime 6.26.0, and regerator-runtime 0.11.0. We are currently on common-tags 1.4.0, but I still saw this same issue after updating to the latest. Also, our webpack build has multiple entry points, not all of which use common-tags. If I remove the ones that DO use it, the build succeeds. As soon as I put them back, it fails again with the same error.

support simple string

I really like using this pkg, and I really need sometimes to use the same great functions for strings,
currently I do oneLine([someString])

Can you please add support for strings so we could do oneLine(someString)?
Thanks

An in-range update of babel-runtime is breaking the build 🚨

Version 6.20.0 of babel-runtime just got published.

Branch Build failing 🚨
Dependency babel-runtime
Current Version 6.18.0
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-runtime is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build is in progress Details

  • ❌ continuous-integration/appveyor/branch Waiting for AppVeyor build to complete Details

  • ❌ bitHound - Dependencies 11 failing dependencies. Details

  • βœ… bitHound - Code No failing files. Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

oneLine does not preserve multiple spaces within input lines

Its name and test suggest that it would ("reduces text to one line, replacing newlines with spaces").

For example the following is unexpected

oneLine`
  Preserve eg sentences.  Double
  spaces within input lines.
` === 'Preserve eg sentences.  Double spaces within input lines.'
// => false

Optionally escape inserted content

It’d be nice to have the option to escape inserted content (you’d only need to detect a prefixed dollar sign):

const name = '<Jane>';
console.log(html`Name: $${name}`);
    // Name: &lt;Jane&gt;

The function that escapes could be configurable. One simple implementation:

function htmlEscape(str) {
    return str.replace(/&/g, '&amp;') // first!
              .replace(/>/g, '&gt;')
              .replace(/</g, '&lt;')
              .replace(/"/g, '&quot;')
              .replace(/'/g, '&#39;')
              .replace(/`/g, '&#96;');
}

An in-range update of doctoc is breaking the build 🚨

Version 1.2.0 of doctoc just got published.

Branch Build failing 🚨
Dependency doctoc
Current Version 1.1.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As doctoc is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ continuous-integration/appveyor/branch Waiting for AppVeyor build to complete Details

  • ❌ continuous-integration/travis-ci/push The Travis CI build is in progress Details

  • ❌ bitHound - Dependencies 1 failing dependency. Details

  • βœ… bitHound - Code No failing files. Details

Commits

The new version differs by 5 commits .

  • a376096 1.2.0
  • 9603fa2 doc: updating TOC in Readme with extra option
  • bb4f414 Added option for stdout
  • eab6f48 Peg anchor-markdown-header to ^0.5.5 (#110)
  • ec0157b Adds --entryprefix flag to use '*' instead of '-'

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of babel-plugin-transform-runtime is breaking the build 🚨

Version 6.23.0 of babel-plugin-transform-runtime just got published.

Branch Build failing 🚨
Dependency babel-plugin-transform-runtime
Current Version 6.22.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-plugin-transform-runtime is β€œonly” a devDependency of this project it might not break production or downstream projects, but β€œonly” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this πŸ’ͺ


Status Details
  • ❌ bitHound - Dependencies 2 failing dependencies. Details

  • βœ… bitHound - Code No failing files. Details

  • βœ… continuous-integration/travis-ci/push The Travis CI build passed Details

  • βœ… continuous-integration/appveyor/branch AppVeyor build succeeded Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Document newer ES features used in the library

The library uses a few newer ES features - one of which is the String.prototype.includes method (related: #112). It would be nice to document them, so that it's easier to polyfill them if needed.

Also might be related: #103.

Objects call their valueOf methods instead of toString methods.

When converting objects into strings that have a custom toString method, I've noticed the lib calls valueOf instead. I don't know if this is intentional, but it really is confusing if you aren't expecting this behavior.

console.log(stripIndents`
    ${obj} is cool!
`);

Assuming obj has a valueOf that returns "1" and a toString that returns "2", the valueOf gets called, which in normal template literals is not the case.

Don't assume array expression has preceding whitespace

When includeArrays is used & an array expression has a non-whitespace character preceding it, an error is thrown. Example:

import { commaLists } from 'common-tags';

let templ, myArray = [ 'a', 'b', 'c' ];

// Does not work
templ = commaLists`
    (${myArray})
`;

// Add a space before the expression & suddenly it works.
templ = commaLists`
    ( ${myArray})
`;

I believe it's reasonable to expect to be able to produce output like (a, b, c).

The error is Cannot read property '1' of null, stemming from this line in tags.js:

expression = expression.join(sep + accumulator.match(/(\s+)$/)[1])

If there's no whitespace at the end of accumulator to copy, perhaps it could default to using a single space.

`source` doesn't seem to work when put into a new template literal?

Here is my current code:

function generateFruits () {
  const fruits = [
    {
      name: 'apples',
      quantity: 3
    },
    {
      name: 'oranges',
      quantity: 2
    }
  ]

  return source`
    Fruits
      ${fruits.map(f => `${f.name}: ${f.quantity}`)}
  `
}

If I do console.log(generateFruits()), I get the expected output:

Fruits
  apples: 3
  oranges: 2

However, if I create a variable called template and use generateFruits() inside of there, it doesn't seem to work:

const template = stripIndent`
  ${generateFruits()}
`

I thought that this would give the same output, but instead it seems to give this:

Fruits
apples: 3
oranges: 2

And if I remove the stripIndent, it gives this:

  Fruits
  apples: 3
  oranges: 2

Why does using generateFruits() inside a different template literal make it lose the indentation?

stripIndent removes trailing new line at end of string

let expectedOutput = stripIndent`
            .foo {
              color: red; }

            .foo {
              color: yellow; }

            .foo {
              color: green; }

            `

Output:

      .foo {\n  color: red; }\n\n.foo {\n  color: yellow; }\n\n.foo {\n  color: green; }

Expected Output:

      .foo {\n  color: red; }\n\n.foo {\n  color: yellow; }\n\n.foo {\n  color: green; }\n

My current workaround:

let expectedOutput = stripIndent`
            .foo {
              color: red; }

            .foo {
              color: yellow; }

            .foo {
              color: green; }
            replace
            `
expectedOutput = expectedOutput.replace('replace', '')

Efficient way of eplacing a string in an external javascript file?

Let me start by saying this project looks awesome.

I need to replace a string inside a javascript file before sending it from a server.

var file = 'var test = ${var}' // or fs.createReadStream('my.js', 'utf8')

reply
      .header('Content-Type', 'application/javascript; charset=UTF-8')
      // replace placeholder in js file
      .send(file)

Would this be possible with this package? πŸ˜„

Thanks!

Support nested html

I've been learning about tagged templates and I discovered common-tags. It's so useful -- many thanks for it!

I was hoping that html might be able to handle nested, multi-line sections, such as you might produce with another html tagged literal. Then you could compose html and have the indenting magically work. But that doesn't seem to be the case.

Here's a test case. Would supporting something like this be at all feasible?

const { html } = require("common-tags");

test("renders nested HTML", () => {
  const fruits = ["apple", "banana", "kiwi"];
  const expected = `<!DOCTYPE html>
<html lang="en">
  <body>
    <ul>
      <li>
        <div>apple</div>
      </li>
      <li>
        <div>banana</div>
      </li>
      <li>
        <div>kiwi</div>
      </li>
    </ul>
  </body
</html>`;

  function renderFruit(fruit) {
    return html`
      <li>
        <div>${fruit}</div>
      </li>`;
  }

  const actual = html`
    <!DOCTYPE html>
    <html lang="en">
      <body>
        <ul>
          ${fruits.map(renderFruit)}
        </ul>
      </body>
    </html>`;

  expect(actual).toBe(expected);
});

Fails to load under [email protected]

I'm using PhantomJS 1.9.8 to test my browserify build (partly because it's still the travis CI default and partly to make sure I'm not pulling in anything that'll blow up on older browsers) and common-tags does. I checked the repo and since it's building with babel I hoped that'd be "good enough" but it's apparently not. Any gut reaction to this issue before I pull things down and dig in further?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.