Giter VIP home page Giter VIP logo

broccoli-asset-rewrite's Introduction

ember-cli

Latest npm release GitHub Actions CI Test Coverage Code Climate

The Ember.js command line utility.

Features

  • Asset build pipeline using Broccoli.js
  • ES6 transpilation using Babel
  • Project structure conventions using ES6 module syntax
  • Development server including live-reload and API proxy
  • File/Project generator using blueprints
  • Unit, Integration and Acceptance test support using Testem
  • Powerful addon system for extensibility

Installation

npm install -g ember-cli

Usage

After installation the ember CLI tool will be available to you. It is the entrypoint for all the functionality mentioned above.

You can call ember <command> --help to find out more about all of the following commands or visit https://cli.emberjs.com/release/ to read the in-depth documentation.

Documentation

Please refer to the CLI guides for help using Ember CLI.

Contributing

Please see the contributing guidelines

Community

License

This project is licensed under the MIT License.

broccoli-asset-rewrite's People

Contributors

balinterdi avatar chrislopresto avatar danmcclain avatar ef4 avatar gojefferson avatar jclem avatar jeffhertzler avatar joankaradimov avatar john-kurkowski avatar joliss avatar jonathankingston avatar jonpitch avatar lukemelia avatar mjuniper avatar olleolleolle avatar pwfisher avatar rickharrison avatar rwjblue avatar twokul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

broccoli-asset-rewrite's Issues

URL encoded attributes cause issues

Using an ember-marked library whilst specifying an asset to serve the marked file causes the following encoded meta field if using a asset prefix:

I'm building the app with:

var app = new EmberApp({
  fingerprint: {
    prepend: 'http://spoon.com/'
  }
});

The config contains:

...
    locationType: 'auto',
    marked: {
      js: '/assets/marked.min.js',
      highlights: false,
    },
...

The result is the config gets replaced with just the URL:

<meta name="ember-sample/config/environment" content="http://spoon.com/assets/marked.min-86992bb7af184bdc37c5799d7bd8055f.js" />

Without the prefix I get:

<meta name="ember-sample/config/environment" content="%7B%22modulePrefix%22%3A%22ember-sample%22%2C%22environment%22%3A%22production%22%2C%22baseURL%22%3A%22/%22%2C%22locationType%22%3A%22auto%22%2C%22marked%22%3A%7B%22js%22%3A%22/assets/marked.min-86992bb7af184bdc37c5799d7bd8055f.js%22%2C%22highlights%22%3Afalse%7D%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%7D%2C%22APP%22%3A%7B%22name%22%3A%22ember-sample%22%2C%22version%22%3A%220.0.0.bb29331f%22%7D%2C%22contentSecurityPolicyHeader%22%3A%22Content-Security-Policy-Report-Only%22%2C%22contentSecurityPolicy%22%3A%7B%22default-src%22%3A%22%27none%27%22%2C%22script-src%22%3A%22%27self%27%22%2C%22font-src%22%3A%22%27self%27%22%2C%22connect-src%22%3A%22%27self%27%22%2C%22img-src%22%3A%22%27self%27%22%2C%22style-src%22%3A%22%27self%27%22%2C%22media-src%22%3A%22%27self%27%22%7D%2C%22exportApplicationGlobal%22%3Afalse%7D" />

I would however expect something more like this:

<meta name="ember-sample/config/environment" content="%7B%22modulePrefix%22%3A%22ember-sample%22%2C%22environment%22%3A%22production%22%2C%22baseURL%22%3A%22/%22%2C%22locationType%22%3A%22auto%22%2C%22marked%22%3A%7B%22js%22%3A%22http://spoon.com/assets/marked.min-86992bb7af184bdc37c5799d7bd8055f.js%22%2C%22highlights%22%3Afalse%7D%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%7D%2C%22APP%22%3A%7B%22name%22%3A%22ember-sample%22%2C%22version%22%3A%220.0.0.bb29331f%22%7D%2C%22contentSecurityPolicyHeader%22%3A%22Content-Security-Policy-Report-Only%22%2C%22contentSecurityPolicy%22%3A%7B%22default-src%22%3A%22%27none%27%22%2C%22script-src%22%3A%22%27self%27%22%2C%22font-src%22%3A%22%27self%27%22%2C%22connect-src%22%3A%22%27self%27%22%2C%22img-src%22%3A%22%27self%27%22%2C%22style-src%22%3A%22%27self%27%22%2C%22media-src%22%3A%22%27self%27%22%7D%2C%22exportApplicationGlobal%22%3Afalse%7D" />

Failing that, just without the prefix as I am fairly sure it isn't needed here however I get this is a very narrow use case.

The problem arises because the matching code looks for anything that doesn't match a closing type character and doesn't expect them to be URL encoded.

AssetRewrite.rewriteAssetPath incorrectly matching remote file paths containing the same name as a valid rewrite

As described in this S.O. issue, if there is a remote file path that contains the same filename as another file that is a valid rewrite (an actual asset path that should be rewritten), the rewriteAssetPath method is processing those paths even though they're to a remote path.

For instance, in a project named coolapp:

model: function() {
  // this path is being rewritten because it's matching `coolapp` but not taking into account that it's from a remote path
  return Ember.$.getJSON('http://my.remote.url.com/coolapp.json');
}

I imagine this probably just needs some adjustments to the regex to prevent matching remote paths.

Fingerprint is appended wrong if files have the same name but different extension

I first posted this issue in Ember-Cli because I didn't know where to open this issue but after a discussion on Slack I think it better fits here. I just copy and paste it, the original issue is here (ember-cli/ember-cli#7466).

When I build an Ember app with the production flag then the broccoli-asset-rewrite does a wrong rewrite of my assets. In my case this happens when broccoli-asset-rewrite rewrites the path to files which are generated by emscripten.

In my public folder there is another folder which is called assets and there is a folder emscripten. The build result of the emscripten is file called emscripten.js and a emscripten.js.mem file. In the emscripten.js file the path to the .mem file is specified like this: var data = {memoryInitializer: 'assets/emscripten/emscripten.js.mem'};. After fingerprinting the path is rewritten to assets/emscripten/emscripten-e9b1f2eed90901137ae71b1fa2427717.js.mem but the filename is still emscripten.js.mem. When I add the .mem extension to be fingerprinted in ember-cli-build.js then the path is rewritten to assets/emscripten/emscripten-93c4916db6cd46010fdec63ab09a2118.js-2de574db8bcd561db3c5f8221f2abd73.mem but the mem file is named emscripten.js-2de574db8bcd561db3c5f8221f2abd73.mem.

Right now we change the paths by hand, because adjusting the emscripten build is not that easy in our whole workflow. Would be great if there is a solution to this problem. I wanted to create some fix but I ended up at some mad regex in broccoli-asset-rewrite where I can not estimate the impact of a change. Furthermore I'm not sure if the bug really comes from there.

I created a repo which should demonstrate the issue:
https://github.com/tschoartschi/ember-cli-fingerprint-problem
To reproduce ember build -e production and check if the output in emscripten.js in memoryInitializer has the correct path to the mem file. I created two git tags, one with the fingerprinting settings I use and one without any settings. See: https://github.com/tschoartschi/ember-cli-fingerprint-problem/releases

Maybe this issue is related to ember-cli/ember-cli#7149 because there the reporter also has the problems of two hashes in one filename

I also think this issue could be very similar to this one: #57

Maybe also related to: ember-cli/broccoli-asset-rev#94


Output from ember version --verbose && npm --version && yarn --version:

ember-cli: 2.16.2
http_parser: 2.7.0
node: 8.4.0
v8: 6.0.286.52
uv: 1.13.1
zlib: 1.2.11
ares: 1.10.1-DEV
modules: 57
nghttp2: 1.22.0
openssl: 1.0.2l
icu: 59.1
unicode: 9.0
cldr: 31.0.1
tz: 2017b
os: darwin x64
5.4.2
1.1.0

Build fails with `fingerprinting.prepend = true`

Fails in version 2.0.0
This bug does not exist in master/3.0.0
The version shipped with latest ember-cli: 3.8.1 is 2.0.0
embroider-build/ember-auto-import#94 (comment)

ENV Summary:

  TIME: Sun Mar 03 2019 21:22:28 GMT+0530 (India Standard Time)
  TITLE: ember
  ARGV:
  - /usr/local/Cellar/node@10/10.15.0/bin/node
  - /usr/local/bin/ember
  - s
  EXEC_PATH: /usr/local/Cellar/node@10/10.15.0/bin/node
  TMPDIR: /var/folders/gy/vrp1632j5432m8f64r1n_c6m0000gn/T
  SHELL: /bin/bash
  PATH:
  - /usr/local/opt/node@10/bin
  - /usr/local/bin
  - /usr/local/bin
  - /usr/bin
  - /bin
  - /usr/sbin
  - /sbin
  PLATFORM: darwin x64
  FREEMEM: 3480100864
  TOTALMEM: 8589934592
  UPTIME: 24936
  LOADAVG: 7.51513671875,4.2802734375,3.32666015625
  CPUS:
  - Intel(R) Core(TM) i5-3335S CPU @ 2.70GHz - 2700
  - Intel(R) Core(TM) i5-3335S CPU @ 2.70GHz - 2700
  - Intel(R) Core(TM) i5-3335S CPU @ 2.70GHz - 2700
  - Intel(R) Core(TM) i5-3335S CPU @ 2.70GHz - 2700
  ENDIANNESS: LE
  VERSIONS:
  - ares: 1.15.0
  - cldr: 34.0
  - http_parser: 2.8.0
  - icu: 63.1
  - modules: 64
  - napi: 3
  - nghttp2: 1.34.0
  - node: 10.15.0
  - openssl: 1.1.0j
  - tz: 2018e
  - unicode: 11.0
  - uv: 1.23.2
  - v8: 6.8.275.32-node.45
  - zlib: 1.2.11

ERROR Summary:

  - broccoliBuilderErrorStack: TypeError: Cannot read property '2' of null
    at AssetRewrite.rewriteAssetPath (/Users/sumeet/projects/srp-client/node_modules/broccoli-asset-rewrite/index.js:127:91)
    at AssetRewrite.processString (/Users/sumeet/projects/srp-client/node_modules/broccoli-asset-rewrite/index.js:167:24)
    at AssetRewrite.processFile (/Users/sumeet/projects/srp-client/node_modules/broccoli-filter/index.js:165:31)
    at asyncProcessFile (/Users/sumeet/projects/srp-client/node_modules/broccoli-filter/index.js:122:21)
    at tryCatch (/Users/sumeet/projects/srp-client/node_modules/rsvp/dist/rsvp.js:525:12)
    at invokeCallback (/Users/sumeet/projects/srp-client/node_modules/rsvp/dist/rsvp.js:538:13)
    at /Users/sumeet/projects/srp-client/node_modules/rsvp/dist/rsvp.js:606:14
    at flush (/Users/sumeet/projects/srp-client/node_modules/rsvp/dist/rsvp.js:2415:5)
    at process._tickCallback (internal/process/next_tick.js:61:11)
  - code: [undefined]
  - codeFrame: Cannot read property '2' of null
  - errorMessage: assets/test-support-ed34232ecba91175bdfd42b735eac4a9.js: Cannot read property '2' of null
        in /var/folders/gy/vrp1632j5432m8f64r1n_c6m0000gn/T/broccoli-7006Xf9VxTec2khb/out-1291-fingerprint
        at AssetRewrite
  - errorType: Build Error
  - location:
    - column: [undefined]
    - file: assets/test-support-ed34232ecba91175bdfd42b735eac4a9.js
    - line: [undefined]
    - treeDir: /var/folders/gy/vrp1632j5432m8f64r1n_c6m0000gn/T/broccoli-7006Xf9VxTec2khb/out-1291-fingerprint
  - message: assets/test-support-ed34232ecba91175bdfd42b735eac4a9.js: Cannot read property '2' of null
        in /var/folders/gy/vrp1632j5432m8f64r1n_c6m0000gn/T/broccoli-7006Xf9VxTec2khb/out-1291-fingerprint
        at AssetRewrite
  - name: BuildError
  - nodeAnnotation: [undefined]
  - nodeName: AssetRewrite
  - originalErrorMessage: Cannot read property '2' of null
  - stack: TypeError: Cannot read property '2' of null
    at AssetRewrite.rewriteAssetPath (/Users/sumeet/projects/srp-client/node_modules/broccoli-asset-rewrite/index.js:127:91)
    at AssetRewrite.processString (/Users/sumeet/projects/srp-client/node_modules/broccoli-asset-rewrite/index.js:167:24)
    at AssetRewrite.processFile (/Users/sumeet/projects/srp-client/node_modules/broccoli-filter/index.js:165:31)
    at asyncProcessFile (/Users/sumeet/projects/srp-client/node_modules/broccoli-filter/index.js:122:21)
    at tryCatch (/Users/sumeet/projects/srp-client/node_modules/rsvp/dist/rsvp.js:525:12)
    at invokeCallback (/Users/sumeet/projects/srp-client/node_modules/rsvp/dist/rsvp.js:538:13)
    at /Users/sumeet/projects/srp-client/node_modules/rsvp/dist/rsvp.js:606:14
    at flush (/Users/sumeet/projects/srp-client/node_modules/rsvp/dist/rsvp.js:2415:5)
    at process._tickCallback (internal/process/next_tick.js:61:11)

Regex for matching assetPath picks up noise in certain cases

Assume that assetPath (in rewriteAssetPath) is "popper.js.map", and assume that string contains the following substring:

er.placements = placements;
Popper.Defaults = Defaults;

return Popper;

})));
//# sourceMappingURL=popper.js.map

}
;if (typeof FastBoot === 'undefined') {
/*!
 * clipboard.js v1.7.1
 * https://zenor

The existing regex will make the following match:

popper.js.map

}
;if

Which causes the following line to break:

replaceString = this.prepend + removeLeadingRelativeOrSlashRegex.exec(replaceString)[2];

I've proposed a solution in a PR: #64

Rewriting relative urls fail on windows + tests fail too

On windows relative url's do not get rewritten when using broccoli-asset-rev.

When I run the test suite from this project on windows then two tests fail.

  1. broccoli-asset-rev rewrites relative urls:
  AssertionError: assets/url-in-styles.css: does not match expected output
  + expected - actual

  +.sample-img{width:50px;height:50px;background-image:url('images/foobar-fingerprint.png')}<CR>
  -.sample-img{width:50px;height:50px;background-image:url('images/foobar.png')}<CR>

   <CR>
  +.sample-img2{width:50px;height:50px;background-image:url('./images/baz-fingerprint.png')}<CR>
  -.sample-img2{width:50px;height:50px;background-image:url('./images/baz.png')}<CR>
  1. broccoli-asset-rev rewrites relative urls with prepend:
  AssertionError: assets/url-in-styles.css: does not match expected output
  + expected - actual

  +.sample-img{width:50px;height:50px;background-image:url('https://cloudfront.net/assets/images/foobar-fingerprint.png')}<CR>
  -.sample-img{width:50px;height:50px;background-image:url('images/foobar.png')}<CR>

I have been digging into the code and the problem lies with using the relative package to get the relative path https://github.com/rickharrison/broccoli-asset-rewrite/blob/master/index.js#L124.
The path it returns uses the path seperator of the current environment (on windows being ''). So in the 'rewrites relative urls' test assets / images / foobar.png becomes images \ foobar.png

Triple prepend assets

Updated to latest and assets are now getting "assets" three times when using customHash and prepend.

in:
<img src="assets/icons/stripe.svg">
out:
<img src="http://localhost:4200/assets/assets/assets/icons/stripe.svg">

  var fingerprintOptions = {
    enabled: true,
    extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map', 'svg'],
    generateAssetMap: true,
    prepend: 'http://localhost:4200/',
    customHash: null,
    generateAssetMap: false
  };

Looks specific to customHash again (removing that fixes again) and may be related to ember-cli/broccoli-asset-rev#87

Why does rewriteAssetPath forbid trailing = (equals)?

The regular expression in rewriteAssetPath() forbids trailing equals, so this means if I have an asset key like path/to/asset.png this will successfully rewrite path/to/asset.png?1234 but not path/to/asset.png?v=1234.

My feeling is that it's a bug that the former is allowed but the latter is not, but I'm unsure as to whether they should both be allowed or forbidden,

rewriteAssetPath matches code blocks

I have a project called Ted that uses ember-simple-auth. At some point in the ember build pipeline the regex /["'\(=]{1}\s*([^"'\(\)=]*ted\.js[^"'\(\)\\>=]*)(\?[^"'\)> ]*)?\s*[\\]*\s*["'\)> ]{1}/g is used on the vendor file. Since ember-simple-auth has a code part like this

transition and instead transitions to the
{{#crossLink "Configuration/authenticationRoute:property"}}{{/crossLink}} if
the session is not authenticated.

```js
// app/routes/protected.js
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';

export default Ember.Route.extend(AuthenticatedRouteMixin);
```

The regex now matches

"}}{{/crossLink}} if
the session is not authenticated.

```js
// app/routes/protected.js
import AuthenticatedRouteMixin from '

which leads to this error

File: assets/vendor-6461e56a880aae756be022e1c294a533.js
The Broccoli Plugin: [AssetRewrite] failed with:
TypeError: Cannot read property '2' of null
    at AssetRewrite.rewriteAssetPath (/###/Projects/ted/node_modules/broccoli-asset-rev/node_modules/broccoli-asset-rewrite/index.js:124:91)
    at AssetRewrite.processString (/###/Projects/ted/node_modules/broccoli-asset-rev/node_modules/broccoli-asset-rewrite/index.js:163:24)
    at AssetRewrite.processFile (/###/Projects/ted/node_modules/broccoli-asset-rev/node_modules/broccoli-filter/index.js:165:31)
    at asyncProcessFile (/###/Projects/ted/node_modules/broccoli-asset-rev/node_modules/broccoli-filter/index.js:122:21)
    at lib$rsvp$$internal$$tryCatch (/###/Projects/ted/node_modules/broccoli-asset-rev/node_modules/rsvp/dist/rsvp.js:493:16)
    at lib$rsvp$$internal$$invokeCallback (/###/Projects/ted/node_modules/broccoli-asset-rev/node_modules/rsvp/dist/rsvp.js:505:17)
    at /###/Projects/ted/node_modules/broccoli-asset-rev/node_modules/rsvp/dist/rsvp.js:1001:13
    at lib$rsvp$asap$$flush (/###/Projects/ted/node_modules/broccoli-asset-rev/node_modules/rsvp/dist/rsvp.js:1198:9)
    at nextTickCallbackWith0Args (node.js:420:9)
    at process._tickCallback (node.js:349:13)

The broccoli plugin was instantiated at: 
    at AssetRewrite.Plugin (/###/Projects/ted/node_modules/broccoli-asset-rev/node_modules/broccoli-filter/node_modules/broccoli-plugin/index.js:7:31)
    at AssetRewrite.Filter [as constructor] (/###/Projects/ted/node_modules/broccoli-asset-rev/node_modules/broccoli-filter/index.js:34:10)
    at new AssetRewrite (/###/Projects/ted/node_modules/broccoli-asset-rev/node_modules/broccoli-asset-rewrite/index.js:27:10)
    at AssetRewrite (/###/Projects/ted/node_modules/broccoli-asset-rev/node_modules/broccoli-asset-rewrite/index.js:22:12)
    at new AssetRev (/###/Projects/ted/node_modules/broccoli-asset-rev/lib/asset-rev.js:29:10)
    at AssetRev (/###/Projects/ted/node_modules/broccoli-asset-rev/lib/asset-rev.js:7:12)
    at Class.module.exports.postprocessTree (/###/Projects/ted/node_modules/broccoli-asset-rev/index.js:32:14)
    at /###/Projects/ted/node_modules/ember-cli/lib/broccoli/ember-app.js:506:27
    at Array.forEach (native)
    at EmberApp.addonPostprocessTree (/###/Projects/ted/node_modules/ember-cli/lib/broccoli/ember-app.js:504:23)

Any suggestions for a workaround for now?

Rewrite incorrectly applied to cases where assetPath exists with arbitrary suffix

I've stumbled across an issue where:

  doSomething('myapp.js.something');

is replaced with:

  doSomething('myapp-48aceae9b10d78520352913b3085d74c.js.something');

It seems that rewriteAssetPath intentionally accepts and preserves any suffix that does not contain one of: " ' ( ) \ > =

Possibly there is some reason for this behavior, but I can't imagine what it is, especially since the query string is expected after this arbitrary suffix.

At the very least, it seems wrong to match additional path-like suffixes like:

  • myapp.js0
  • myapp.js_alt
  • myapp.js.other
  • myapp.js/subfile

Enable Travis

Will have to log into Travis and enable for this repo.

Double prepend

We're using a Rails-backend index loaded from redis as shown here in the ember-cli-deploy lightning method. https://github.com/ghedamat/ember-deploy-demo/blob/master/edd-cli/ember-cli-build.js#L15

Since upgrading to latest, all the asset urls are double prepended, we're ending up with

GET http://localhost:4200/http://localhost:4200/assets/vendor.css

Locking the following in package.json seems to work for us...

asset-rev 2.2.0
asset-rewrite 1.0.9 

so looks like one of the recent commits after that, more than likely: #26

Remove CircleCI setup

This needs to be done by someone with admin access to the repo (which ATM is only @rickharrison), but if he is up for transferring (see #79) then we could take care of it there.

Asset rewrite strips fragments from urls

We have svg xlink:hrefs that end with a fragment (images/defs.svg#dribbble), and string replacement replaces the #dribble, breaking out svgs. I'm debugging now, and will have a PR shortly, wanted to track in the mean time

doesn't handle multiple references to the same URL

Given the input

.sample-img-small   { width:  50px; height:  50px; background-image:url(/images/defs.svg#plus) }
.sample-img-medium  { width:  80px; height:  80px; background-image:url(/images/defs.svg#plus) }
.sample-img-large   { width: 120px; height: 120px; background-image:url(/images/defs.svg#plus) }
.sample-img-xlarge  { width: 240px; height: 240px; background-image:url(/images/defs.svg#plus) }

with options

{
  assetMap: {
    'images/defs.svg': 'assets/images/defs.svg'
  },
  prepend: 'https://cloudfront.net/'
}

Expected:

.sample-img-small   { width:  50px; height:  50px; background-image:url(https://cloudfront.net/assets/images/defs.svg#plus) }
.sample-img-medium  { width:  80px; height:  80px; background-image:url(https://cloudfront.net/assets/images/defs.svg#plus) }
.sample-img-large   { width: 120px; height: 120px; background-image:url(https://cloudfront.net/assets/images/defs.svg#plus) }
.sample-img-xlarge  { width: 240px; height: 240px; background-image:url(https://cloudfront.net/assets/images/defs.svg#plus) }

Actual:

.sample-img-small   { width:  50px; height:  50px; background-image:url(https://cloudfront.net/assets/assets/assets/assets/assets/assets/assets/assets/images/defs.svg#plus) }
.sample-img-medium  { width:  80px; height:  80px; background-image:url(https://cloudfront.net/assets/assets/assets/assets/assets/assets/assets/assets/images/defs.svg#plus) }
.sample-img-large   { width: 120px; height: 120px; background-image:url(https://cloudfront.net/assets/assets/assets/assets/assets/assets/assets/assets/images/defs.svg#plus) }
.sample-img-xlarge  { width: 240px; height: 240px; background-image:url(https://cloudfront.net/assets/assets/assets/assets/assets/assets/assets/assets/images/defs.svg#plus) }

(note the 8 nested assets folders)

I have a failing test, working on a PR now...

Issue with Ember Deploy

I am getting this error when trying to run an ember deploy:

- build failed Error: Build Canceled: Broccoli Builder ran into an error with AssetRewrite plugin. ๐Ÿ’ฅ Cannot read property '2' of null TypeError: Cannot read property '2' of null at AssetRewrite.rewriteAssetPath (/home/ubuntu/hart/node_modules/broccoli-asset-rewrite/index.js:127:91) at AssetRewrite.processString (/home/ubuntu/hart/node_modules/broccoli-asset-rewrite/index.js:167:24) at AssetRewrite.processFile (/home/ubuntu/hart/node_modules/broccoli-filter/index.js:165:31) at asyncProcessFile (/home/ubuntu/hart/node_modules/broccoli-filter/index.js:122:21) at tryCatch (/home/ubuntu/hart/node_modules/rsvp/dist/rsvp.js:525:12) at invokeCallback (/home/ubuntu/hart/node_modules/rsvp/dist/rsvp.js:538:13) at /home/ubuntu/hart/node_modules/rsvp/dist/rsvp.js:606:14 at flush (/home/ubuntu/hart/node_modules/rsvp/dist/rsvp.js:2415:5) at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9) Pipeline aborted

v1.0.12 breaks asset paths in addon CSS

I verified that everything works if I force it to 1.0.11.

But at 1.0.12, I get the following issue:

We have an ember-cli app that uses ember-cli-bootstrap-colorpicker. When we do a production build, the vendor css contains URLs that look like this:

//my-assets-url/assets/../img/bootstrap-colorpicker/saturation-668d0a0e7a0189f62898bcc57ab8370c.png

Note the /../ in the middle of the url - that causes it to resolve to the wrong url and 404. Again, when I forced broccoli-asset-rev to use v1.0.11 of broccoli-asset-rewrite, we no longer see this issue and we get proper urls in the css like:

//my-assets-url/assets/img/bootstrap-colorpicker/saturation-668d0a0e7a0189f62898bcc57ab8370c.png

Prepending of relative and absolute path to same asset fails

When having multiple paths to same asset, but mixed with absolute and relative paths, prepending fails:

let relativePath = "assets/images/some-image.svg";
let absolutePath = "/assets/images/some-image.svg";

generates this:

let relativePath = "https://cloudfront.net/assets/images/some-image-fingerprinted.svg";
let absolutePath = "/https://cloudfront.net/assets/images/some-image-fingerprinted.svg";

I created PR #71 with a failing spec. I couldn't find and fix the code myself....

Doesn't handle multiple, similar, reference to the same file

See original issue here: ember-cli/broccoli-asset-rev#116

Given the input:

<img src="assets/images/picture.png"/>
<img src="/assets/images/picture.png"/>

And a fingerprint of https://mycdn.com/

The output is:

<img src="https://mycdn.com/assets/images/picture.png"/>
<img src="/https://mycdn.com/assets/images/picture.png"/>

(Note the incorrect slash at the start of the second URL.)

This can be avoided by using the exact same URLs everywhere in your source code. It would be nice, however, if the rewrite engine handled this automatically (eg a sort to process the longer replacements first?)

Fingerprinting for srcset not working

The fingerprinting for srcset in html image tags is not working.
I took a look at the implementation of the regex. But this goes over my head ..
Anybody seeing a solution?

Feel free to use the breaking tests => #50

Release notes/CHANGELOG

๐Ÿ‘‹ Thanks for your excellent work on this lib!

Any chance we could get release notes or a CHANGELOG, especially for major version releases? I'm coming here from broccoli-asset-rev, trying to understand what breaking API change happened over there from 2.7 to 3.0.

Transfer to ember-cli org?

๐Ÿ‘‹ @rickharrison ๐Ÿ‘‹

What do you think about possibly transferring this repo over into the ember-cli organization? If you are open for it, I've sent you an invite to the ember-cli-repository-transfers organization which you should be able to accept and move this project into. From there I'll transfer it into the ember-cli org.

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.