Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: postcss/postcss-import
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 16.0.1
Choose a base ref
...
head repository: postcss/postcss-import
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 16.1.0
Choose a head ref
  • 2 commits
  • 11 files changed
  • 2 contributors

Commits on Mar 16, 2024

  1. Allow urls that contain fragments, fixes #560 (#561)

    romainmenke authored Mar 16, 2024
    Copy the full SHA
    eb9899b View commit details

Commits on Mar 20, 2024

  1. 16.1.0

    RyanZim committed Mar 20, 2024
    Copy the full SHA
    9217ec3 View commit details
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 16.1.0 / 2024-03-20

- Allow bundling URLs with fragments (useful for Vite users) ([#560](https://github.com/postcss/postcss-import/issues/560), [#561](https://github.com/postcss/postcss-import/pull/561))

# 16.0.1 / 2024-02-14

- Fix crash when handling some `@import`s with media conditions ([#557](https://github.com/postcss/postcss-import/issues/557), [#558](https://github.com/postcss/postcss-import/pull/558))
5 changes: 0 additions & 5 deletions lib/parse-styles.js
Original file line number Diff line number Diff line change
@@ -227,11 +227,6 @@ function isProcessableURL(uri) {
try {
// needs a base to parse properly
const url = new URL(uri, "https://example.com")

if (url.hash) {
return false
}

if (url.search) {
return false
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postcss-import",
"version": "16.0.1",
"version": "16.1.0",
"description": "PostCSS plugin to import CSS files",
"keywords": [
"css",
1 change: 0 additions & 1 deletion test/fixtures/filter-ignore.css
Original file line number Diff line number Diff line change
@@ -13,5 +13,4 @@
@import url('//css');
@import url(//css);
@import url('foo.css?query=string');
@import url('foo.css#hash');
content{}
1 change: 0 additions & 1 deletion test/fixtures/filter-ignore.expected.css
Original file line number Diff line number Diff line change
@@ -14,7 +14,6 @@
@import url('//css');
@import url(//css);
@import url('foo.css?query=string');
@import url('foo.css#hash');
@media (min-width: 25em){
ignore{}
}
3 changes: 3 additions & 0 deletions test/fixtures/imports/modules/subpath/a.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.foo {
color: green;
}
6 changes: 6 additions & 0 deletions test/fixtures/imports/modules/subpath/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"style": "style.css",
"imports": {
"#a.css": "./a.css"
}
}
1 change: 1 addition & 0 deletions test/fixtures/imports/modules/subpath/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import '#a.css';
1 change: 1 addition & 0 deletions test/fixtures/subpath.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "subpath";
3 changes: 3 additions & 0 deletions test/fixtures/subpath.expected.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.foo {
color: green;
}
23 changes: 23 additions & 0 deletions test/resolve.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"use strict"
// external tooling
const test = require("ava")
const fs = require("fs")
const path = require("path")

// internal tooling
const checkFixture = require("./helpers/check-fixture")
@@ -72,3 +74,24 @@ test(
{ path: null, addModulesDirectories: ["shared_modules"] },
{ from: "test/fixtures/imports/foo.css" },
)

test(
"should resolve modules with node subpath imports with a custom resolver",
checkFixture,
"subpath",
{
resolve: (id, basedir) => {
// see: https://nodejs.org/api/packages.html#subpath-imports
if (id.startsWith("#")) {
const pkgJSON = JSON.parse(
fs.readFileSync(path.join(basedir, "package.json")),
)

return path.join(basedir, pkgJSON.imports[id])
}

return id
},
path: "test/fixtures/imports/modules",
},
)