Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: source maps path on windows #532

Merged
merged 2 commits into from May 22, 2017
Merged

fix: source maps path on windows #532

merged 2 commits into from May 22, 2017

Conversation

alexander-akait
Copy link
Member

What kind of change does this PR introduce?
bugfix

Did you add tests for your changes?

yes

If relevant, did you update the README?

Summary

#529

Does this PR introduce a breaking change?

No.

Other information

We need more tests and good review on this.

@codecov
Copy link

codecov bot commented May 11, 2017

Codecov Report

Merging #532 into master will increase coverage by 0.29%.
The diff coverage is 90%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #532      +/-   ##
==========================================
+ Coverage   98.36%   98.65%   +0.29%     
==========================================
  Files          10       10              
  Lines         366      371       +5     
  Branches       87       89       +2     
==========================================
+ Hits          360      366       +6     
+ Misses          6        5       -1
Impacted Files Coverage Δ
lib/processCss.js 98.03% <0%> (ø) ⬆️
lib/loader.js 100% <100%> (+1.38%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fe4cf7a...92fc8d9. Read the comment docs.

Copy link
Member

@michael-ciniawsky michael-ciniawsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still node >= v0.12 in theory

lib/loader.js Outdated
}

if (map.sources) {
map.sources = map.sources.map((source) => source.replace(/\\/g, '/'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.map((source) => ...) => .map(function(source) { return ... })

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michael-ciniawsky oh yep, i don't support old node.js in my project 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither do I 😛 and I'm really in favour make the switch as quickly as possible (node < 4.0.0 is dead), but if we 'break' things all kind of conservatives will come out of their rat holes and complain like crazy about it :D 'breaks app IN PRODUCTION' 'USE SEMVER!!!` etc...

@michael-ciniawsky
Copy link
Member

https://github.com/postcss/postcss/blob/master/lib/map-generator.es6#L188-L189

But it seems to work on the relative file path (L187) only atm and maybe unrelated 😛

@alexander-akait alexander-akait force-pushed the issue-529 branch 4 times, most recently from 1863a86 to 86332ba Compare May 12, 2017 13:29
@alexander-akait
Copy link
Member Author

/cc @michael-ciniawsky

@@ -30,8 +39,8 @@ module.exports = function(content, map) {

processCss(content, map, {
mode: moduleMode ? "local" : "global",
from: loaderUtils.getRemainingRequest(this),
to: loaderUtils.getCurrentRequest(this),
from: loaderUtils.getRemainingRequest(this).split("!").pop(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the output of loaderUtils.getRemainingRequest(this).split("!").pop()? If I remember right it should be the absolute file path and therefore we could replaced it with this.resourcePath instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best get file from getRemainingRequest it is more safe

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kk also not really related to this PR, just pop into my eyes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look into resourcePath, yup. I can't remember the exact API, though. Maybe this needs some guidelines.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bebraw why? what is bad in use loaderUtils.getRemainingRequest(this).split("!").pop(), also #532 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evilebottnawi I'm not entirely sure. At least test-wise the current implementation passes. It's fine to refactor later. 👍

from: loaderUtils.getRemainingRequest(this),
to: loaderUtils.getCurrentRequest(this),
from: loaderUtils.getRemainingRequest(this).split("!").pop(),
to: loaderUtils.getCurrentRequest(this).split("!").pop(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be equal to this.resourcePath aswell

Copy link
Member

@michael-ciniawsky michael-ciniawsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rubberstamp LTGM, I have no windows machine to test this, but looks 👍 land it if you think it's good to go

@alexander-akait
Copy link
Member Author

@michael-ciniawsky if we enable appveyor i can rewrite all tests for compatibility with windows (now tests written only for linux based os)


if (map.sources) {
map.sources = map.sources.map(function (source) {
return source.replace(/\\/g, '/');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test with path.sep? But I think it's unnecessary...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michael-ciniawsky yep, we should already changed \ to /

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michael-ciniawsky This is a source map check. Can we assume forward slash there due to browser environment?

@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented May 12, 2017

Yep appveyor would be a good idea, want is need to enable it besides appveyor.yml ? For Org access ping bebraw or d3viant0ne 😛

@bebraw
Copy link
Contributor

bebraw commented May 13, 2017

@d3viant0ne Yeah, fair point. Better get Tobias' approval first. 👍

@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented May 21, 2017

@evilebottnawi @d3viant0ne @bebraw I think we should merge this meanwhile, despite the fact that current implementation will hopefully vanish soon 😛 , it's definitely a bug in the current css-loader

@joshwiens
Copy link
Member

@evilebottnawi Open an issue in defaults for appveyor and we can get started on a org wide config as a part of defaults.

@joshwiens
Copy link
Member

As far as this particular PR goes, there are a few open review comments. Patches are fine for the current major version so @bebraw @evilebottnawi @michael-ciniawsky if everyone is satisfied with this, throw a thumbs up on the comment and we'll get this landed.

@michael-ciniawsky
Copy link
Member

AppVeyor Tracking Issue #54

@michael-ciniawsky michael-ciniawsky merged commit c3d0d91 into master May 22, 2017
@michael-ciniawsky michael-ciniawsky deleted the issue-529 branch May 22, 2017 00:21
@michael-ciniawsky michael-ciniawsky removed this from Bug in Dashboard May 22, 2017
@michael-ciniawsky michael-ciniawsky modified the milestone: 0.29.0 May 22, 2017
eliperelman pushed a commit to neutrinojs/neutrino that referenced this pull request Jul 10, 2018
This Pull Request updates dependency [css-loader](https://github.com/webpack-contrib/css-loader) from `^0.28.11` to `^1.0.0`



<details>
<summary>Release Notes</summary>

### [`v1.0.0`](https://github.com/webpack-contrib/css-loader/blob/master/CHANGELOG.md#&#8203;100httpsgithubcomwebpack-contribcss-loadercomparev02811v100-2018-07-06)
[Compare Source](webpack-contrib/css-loader@v0.28.11...v1.0.0)
##### BREAKING CHANGES

* remove `minimize` option, use [`postcss-loader`](https://github.com/postcss/postcss-loader) with [`cssnano`](https://github.com/cssnano/cssnano) or use [`optimize-cssnano-plugin`](https://github.com/intervolga/optimize-cssnano-plugin) plugin
* remove `module` option, use `modules` option instead
* remove `camelcase` option, use `camelCase` option instead
* remove `root` option, use [`postcss-loader`](https://github.com/postcss/postcss-loader) with [`postcss-url`](https://github.com/postcss/postcss-url) plugin
* remove `alias` option, use [`resolve.alias`](https://webpack.js.org/configuration/resolve/) feature or use [`postcss-loader`](https://github.com/postcss/postcss-loader) with [`postcss-url`](https://github.com/postcss/postcss-url) plugin
* update `postcss` to `6` version
* minimum require `nodejs` version is `6.9`
* minimum require `webpack` version is `4`
#### [0.28.11](webpack-contrib/css-loader@v0.28.10...v0.28.11) (2018-03-16)
##### Bug Fixes

* **lib/processCss:** don't check `mode` for `url` handling (`options.modules`) ([#&#8203;698](`webpack-contrib/css-loader#698)) ([c788450](webpack-contrib/css-loader@c788450))
#### [0.28.10](webpack-contrib/css-loader@v0.28.9...v0.28.10) (2018-02-22)
##### Bug Fixes

* **getLocalIdent:** add `rootContext` support (`webpack >= v4.0.0`) ([#&#8203;681](`webpack-contrib/css-loader#681)) ([9f876d2](webpack-contrib/css-loader@9f876d2))
#### [0.28.9](webpack-contrib/css-loader@v0.28.8...v0.28.9) (2018-01-17)
##### Bug Fixes

* ignore invalid URLs (`url()`) ([#&#8203;663](`webpack-contrib/css-loader#663)) ([d1d8221](webpack-contrib/css-loader@d1d8221))
#### [0.28.8](webpack-contrib/css-loader@v0.28.7...v0.28.8) (2018-01-05)
##### Bug Fixes

* **loader:** correctly check if source map is `undefined` ([#&#8203;641](`webpack-contrib/css-loader#641)) ([0dccfa9](webpack-contrib/css-loader@0dccfa9))
* proper URL escaping and wrapping (`url()`) ([#&#8203;627](`webpack-contrib/css-loader#627)) ([8897d44](webpack-contrib/css-loader@8897d44))
#### [0.28.7](webpack-contrib/css-loader@v0.28.6...v0.28.7) (2017-08-30)
##### Bug Fixes

* pass resolver to `localsLoader` (`options.alias`)  ([#&#8203;601](`webpack-contrib/css-loader#601)) ([8f1b57c](webpack-contrib/css-loader@8f1b57c))
#### [0.28.6](webpack-contrib/css-loader@v0.28.5...v0.28.6) (2017-08-30)
##### Bug Fixes

* add support for aliases starting with `/` (`options.alias`) ([#&#8203;597](`webpack-contrib/css-loader#597)) ([63567f2](webpack-contrib/css-loader@63567f2))
#### [0.28.5](webpack-contrib/css-loader@v0.28.4...v0.28.5) (2017-08-17)
##### Bug Fixes

* match mutliple dashes (`options.camelCase`) ([#&#8203;556](`webpack-contrib/css-loader#556)) ([1fee601](webpack-contrib/css-loader@1fee601))
* stricter `[@import]` tolerance ([#&#8203;593](`webpack-contrib/css-loader#593)) ([2e4ec09](webpack-contrib/css-loader@2e4ec09))
#### [0.28.4](webpack-contrib/css-loader@v0.28.3...v0.28.4) (2017-05-30)
##### Bug Fixes

* preserve leading underscore in class names ([#&#8203;543](`webpack-contrib/css-loader#543)) ([f6673c8](webpack-contrib/css-loader@f6673c8))
#### [0.28.3](webpack-contrib/css-loader@v0.28.2...v0.28.3) (2017-05-25)
##### Bug Fixes

* correct plugin order for CSS Modules ([#&#8203;534](`webpack-contrib/css-loader#534)) ([b90f492](webpack-contrib/css-loader@b90f492))
#### [0.28.2](webpack-contrib/css-loader@v0.28.1...v0.28.2) (2017-05-22)
##### Bug Fixes

* source maps path on `windows` ([#&#8203;532](`webpack-contrib/css-loader#532)) ([c3d0d91](webpack-contrib/css-loader@c3d0d91))
#### [0.28.1](webpack-contrib/css-loader@v0.28.0...v0.28.1) (2017-05-02)
##### Bug Fixes

* allow to specify a full hostname as a root URL ([#&#8203;521](`webpack-contrib/css-loader#521)) ([06d27a1](webpack-contrib/css-loader@06d27a1))
* case insensitivity of [@&#8203;import] ([#&#8203;514](`webpack-contrib/css-loader#514)) ([de4356b](webpack-contrib/css-loader@de4356b))
* don't handle empty [@&#8203;import] and url() ([#&#8203;513](`webpack-contrib/css-loader#513)) ([868fc94](webpack-contrib/css-loader@868fc94))
* imported variables are replaced in exports if followed by a comma ([#&#8203;504](`webpack-contrib/css-loader#504)) ([956bad7](webpack-contrib/css-loader@956bad7))
* loader now correctly handles `url` with space(s) ([#&#8203;495](`webpack-contrib/css-loader#495)) ([534ea55](webpack-contrib/css-loader@534ea55))
* url with a trailing space is now handled correctly ([#&#8203;494](`webpack-contrib/css-loader#494)) ([e1ec4f2](webpack-contrib/css-loader@e1ec4f2))
* use `btoa` instead `Buffer` ([#&#8203;501](`webpack-contrib/css-loader#501)) ([fbb0714](webpack-contrib/css-loader@fbb0714))
##### Performance Improvements

* generate source maps only when explicitly set ([#&#8203;478](`webpack-contrib/css-loader#478)) ([b8f5c8f](webpack-contrib/css-loader@b8f5c8f))

---

</details>




---

This PR has been generated by [Renovate Bot](https://renovatebot.com).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants