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

using path.parse() method to check if the provided path is relative o… #17

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

using path.parse() method to check if the provided path is relative o… #17

wants to merge 4 commits into from

Conversation

mightyaleksey
Copy link
Member

Issue: #16


// Checks if the provided path is relative or not
const isModule = pathname => {
const parsed = path.parse(pathname);
Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately, path.parse() is available only in Node.js 0.12+

@mightyaleksey
Copy link
Member Author

Hi, I tried to fix that windows Issue with new path module methods. I would like to know if there is any opportunity to check it on windows?

@geelen
Copy link
Member

geelen commented Aug 15, 2015

I'm fine with dropping Node v0.10 support (unless there's a good reason not to?) but I don't have a windows machine to test on. Maybe @joezimjs could give this a try and I'll merge it if it fixes his problem?

@mightyaleksey
Copy link
Member Author

I'm fine with dropping Node v0.10 support (unless there's a good reason not to?)

I don't know any :)

@joezimjs
Copy link

I cloned @sullenor's repo and went into the win.imports.fix branch, ran npm test and got pretty much the same errors as before:

  test-cases
    1) should compose node module
    2) should localise export
{ [Error: ENOENT, open 'C:\Users\u659408\localhost\css-modules-loader-core\test\test-cases\C:\C:\multiple-dependencies\b.css']
  errno: -4058,
  code: 'ENOENT',
  path: 'C:\\Users\\u659408\\localhost\\css-modules-loader-core\\test\\test-cases\\C:\\C:\\multiple-dependencies\\b.css' }
{ [Error: ENOENT, open 'C:\Users\u659408\localhost\css-modules-loader-core\test\test-cases\C:\C:\multiple-dependencies\c.css']
  errno: -4058,
  code: 'ENOENT',
  path: 'C:\\Users\\u659408\\localhost\\css-modules-loader-core\\test\\test-cases\\C:\\C:\\multiple-dependencies\\c.css' }
    3) should multiple dependencies
    4) should simple export
{ [Error: ENOENT, open 'C:\Users\u659408\localhost\css-modules-loader-core\test\test-cases\C:\C:\single-import-export\colors.css']
  errno: -4058,
  code: 'ENOENT',
  path: 'C:\\Users\\u659408\\localhost\\css-modules-loader-core\\test\\test-cases\\C:\\C:\\single-import-export\\colors.css' }
    5) should single import export

  cssi
{ [Error: ENOENT, open 'C:\Users\u659408\localhost\css-modules-loader-core\test\cssi\C:\C:\interchange-format\colors.css']
  errno: -4058,
  code: 'ENOENT',
  path: 'C:\\Users\\u659408\\localhost\\css-modules-loader-core\\test\\cssi\\C:\\C:\\interchange-format\\colors.css' }
    6) should interchange format
{ [Error: ENOENT, open 'C:\Users\u659408\localhost\css-modules-loader-core\test\cssi\C:\C:\pseudo-variables\colors.css']
  errno: -4058,
  code: 'ENOENT',
  path: 'C:\\Users\\u659408\\localhost\\css-modules-loader-core\\test\\cssi\\C:\\C:\\pseudo-variables\\colors.css' }
    7) should pseudo variables

  multiple sources
{ [Error: ENOENT, open 'C:\Users\u659408\localhost\css-modules-loader-core\test\test-cases\C:\C:\multiple-sources\b.css']
  errno: -4058,
  code: 'ENOENT',
  path: 'C:\\Users\\u659408\\localhost\\css-modules-loader-core\\test\\test-cases\\C:\\C:\\multiple-sources\\b.css' }
{ [Error: ENOENT, open 'C:\Users\u659408\localhost\css-modules-loader-core\test\test-cases\C:\C:\multiple-sources\c.css']
  errno: -4058,
  code: 'ENOENT',
  path: 'C:\\Users\\u659408\\localhost\\css-modules-loader-core\\test\\test-cases\\C:\\C:\\multiple-sources\\c.css' }
{ [Error: ENOENT, open 'C:\Users\u659408\localhost\css-modules-loader-core\test\test-cases\C:\C:\multiple-sources\b.css']
  errno: -4058,
  code: 'ENOENT',
  path: 'C:\\Users\\u659408\\localhost\\css-modules-loader-core\\test\\test-cases\\C:\\C:\\multiple-sources\\b.css' }
    8) should multiple sources


  0 passing (298ms)
  8 failing

  1) test-cases should compose node module:

      AssertionError: '._C_C_C_compose_node_module_cool_styles_foo__example {\n  color: #F00;\n}\n._C_C_compose_node_module_source__foo {\n}\n' == '._compose_node_module_cool_styles_foo__example {\n  color: #F00;\n}\n._compose_node_module_source__foo {\n}\n'
      + expected - actual

      -._C_C_C_compose_node_module_cool_styles_foo__example {
      +._compose_node_module_cool_styles_foo__example {
         color: #F00;
       }
      -._C_C_compose_node_module_source__foo {
      +._compose_node_module_source__foo {
       }

      at C:/Users/u659408/localhost/css-modules-loader-core/test/test-cases.js:27:20

  2) test-cases should localise export:

      AssertionError: '._C_C_localise_export_source__one {\n  color: red;\n}\n._C_C_localise_export_source__two {\n  color: green;\n}\n._C_C_localise_ == '._localise_export_source__one {\n
color: red;\n}\n._localise_export_source__two {\n  color: green;\n}\n._localise_export_sourc
      + expected - actual

      -._C_C_localise_export_source__one {
      +._localise_export_source__one {
         color: red;
       }
      -._C_C_localise_export_source__two {
      +._localise_export_source__two {
         color: green;
       }
      -._C_C_localise_export_source__three {
      +._localise_export_source__three {
         color: blue;
       }

      at C:/Users/u659408/localhost/css-modules-loader-core/test/test-cases.js:27:20

  3) test-cases should multiple dependencies:

      AssertionError: ':import("./b.css") {\n  i__imported_b1_0: b1;\n  i__imported_b2_1: b2;\n}\n:import("./c.css") {\n  i__imported_c_2: c;\n}\n._C_ == '._multiple_dependencies_d__d1 {\n
color: #d1d1d1;\n}\n._multiple_dependencies_d__d2 {\n  color: #d2d2d2;\n}\n._multiple_depend
      + expected - actual

      -:import("./b.css") {
      -  i__imported_b1_0: b1;
      -  i__imported_b2_1: b2;
      +._multiple_dependencies_d__d1 {
      +  color: #d1d1d1;
       }
      -:import("./c.css") {
      -  i__imported_c_2: c;
      +._multiple_dependencies_d__d2 {
      +  color: #d2d2d2;
       }
      -._C_C_multiple_dependencies_source__a {
      +._multiple_dependencies_b__b1 {
      +  color: #b1b1b1;
      +}
      +
      +._multiple_dependencies_b__b2 {
      +  color: #b2b2b2;
      +}
      +._multiple_dependencies_c__c {
      +  color: #ccc;
      +}
      +._multiple_dependencies_source__a {
         color: #aaa;
       }


      at C:/Users/u659408/localhost/css-modules-loader-core/test/test-cases.js:27:20

  4) test-cases should simple export:

      AssertionError: '._C_C_simple_export_source__localName {\n  color: red;\n}\n\n._C_C_simple_export_source__localName:hover {\n  color: blue;\n}\n == '._simple_export_source__localName {\n  color: red;\n}\n\n._simple_export_source__localName:hover {\n  color: blue;\n}\n'
      + expected - actual

      -._C_C_simple_export_source__localName {
      +._simple_export_source__localName {
         color: red;
       }

      -._C_C_simple_export_source__localName:hover {
      +._simple_export_source__localName:hover {
         color: blue;
       }

      at C:/Users/u659408/localhost/css-modules-loader-core/test/test-cases.js:27:20

  5) test-cases should single import export:

      AssertionError: ':import("./colors.css") {\n  i__imported_blackShadow_0: blackShadow;\n
i__imported_redBorder_1: redBorder;\n}\n._C_C_single_im == '._single_import_export_colors__blackShadow {\n  box-shadow: 0 0 10px -2px black;\n}\n\n._single_import_export_colors__redBorder
      + expected - actual

      -:import("./colors.css") {
      -  i__imported_blackShadow_0: blackShadow;
      -  i__imported_redBorder_1: redBorder;
      +._single_import_export_colors__blackShadow {
      +  box-shadow: 0 0 10px -2px black;
       }
      -._C_C_single_import_export_source__localName {
      +
      +._single_import_export_colors__redBorder {
      +  border: 1px solid red;
      +}
      +._single_import_export_source__localName {
         color: red;
       }

      at C:/Users/u659408/localhost/css-modules-loader-core/test/test-cases.js:27:20

  6) cssi should interchange format:

      AssertionError: ':import("./colors.css") {\n  i__tmp_import_djhgdsag: blackShadow;\n}\n\n.x__single_import_export_source__localName {\n  color:  == '.x__single_import_export_colors__blackShadow {\n  box-shadow: 0 0 10px -2px black;\n}\n.x__single_import_export_source__localNa
      + expected - actual

      -:import("./colors.css") {
      -  i__tmp_import_djhgdsag: blackShadow;
      +.x__single_import_export_colors__blackShadow {
      +  box-shadow: 0 0 10px -2px black;
       }
      -
       .x__single_import_export_source__localName {
         color: red;
       }

      at C:/Users/u659408/localhost/css-modules-loader-core/test/test-cases.js:27:20

  7) cssi should pseudo variables:

      AssertionError: ':import("./colors.css") {\n  i__black: black;\n  i__white: white;\n}\n\n.x__lol {\n  color: i__black;\n  background: i__white;\ == '\n.x__lol {\n  color: #222;\n  background: #ddd;\n}\n'
      + expected - actual

      -:import("./colors.css") {
      -  i__black: black;
      -  i__white: white;
      -}

       .x__lol {
      -  color: i__black;
      -  background: i__white;
      +  color: #222;
      +  background: #ddd;
       }

      at C:/Users/u659408/localhost/css-modules-loader-core/test/test-cases.js:27:20

  8) multiple sources should multiple sources:

      AssertionError: ':import("./b.css") {\n  i__imported_b_0: b;\n}\n:import("./c.css") {\n
i__imported_c_1: c;\n}\n._C_C_multiple_sources_source1_ == '._multiple_sources_d__d {\n  color: #ddd;\n}\n._multiple_sources_b__b {\n  color: #bbb;\n}\n._multiple_sources_c__c {\n  color:
      + expected - actual

      -:import("./b.css") {
      -  i__imported_b_0: b;
      +._multiple_sources_d__d {
      +  color: #ddd;
       }
      -:import("./c.css") {
      -  i__imported_c_1: c;
      +._multiple_sources_b__b {
      +  color: #bbb;
       }
      -._C_C_multiple_sources_source1__a {
      +._multiple_sources_c__c {
      +  color: #ccc;
      +}
      +._multiple_sources_source1__a {
         color: #aaa;
       }
      -:import("./b.css") {
      -  i__imported_b_0: b;
      -}
      -._C_C_multiple_sources_source2__foo {
      +._multiple_sources_source2__foo {
         color: #f00;
       }

      at C:/Users/u659408/localhost/css-modules-loader-core/test/test-cases.js:48:18



npm ERR! Test failed.  See above for more details.

@cameron-martin
Copy link

Any progress on this? I can test on windows if you need me to, although can't you just set up travis to run the tests on windows?

@cameron-martin
Copy link

Also, I don't quite understand what the root property of FileSystemLoader, as well as the _newPath and relativeTo arguments to fetch are. I also do not get what the difference between rootRelativePath and fileRelativePath is. Can you explain this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants