@eik/postcss-import-map
Advanced tools
+7
-0
@@ -0,1 +1,8 @@ | ||
| ## [1.2.1](https://github.com/eik-lib/postcss-import-map/compare/v1.2.0...v1.2.1) (2020-09-18) | ||
| ### Bug Fixes | ||
| * replace resolve workaround with filter ([7b0dd77](https://github.com/eik-lib/postcss-import-map/commit/7b0dd7715ef537baeae4dd713beb6882c49a84cd)) | ||
| # [1.2.0](https://github.com/eik-lib/postcss-import-map/compare/v1.1.0...v1.2.0) (2020-09-18) | ||
@@ -2,0 +9,0 @@ |
+8
-18
@@ -89,2 +89,6 @@ 'use strict'; | ||
| // The resolve option in postcss-import doesn't support async functions or promises, | ||
| // thus we have to workaround it | ||
| let mapping = new Map(); | ||
| var plugin = postcss__default['default'].plugin( | ||
@@ -95,3 +99,3 @@ '@eik/postcss-import-map', | ||
| return async (root) => { | ||
| const mapping = await getImportMap({ path, urls, imports }); | ||
| mapping = await getImportMap({ path, urls, imports }); | ||
| root.walkAtRules('import', (decl) => { | ||
@@ -122,21 +126,7 @@ let key; | ||
| // Useful for integrating with other plugins such as postcss-import | ||
| function createPostcssImportResolver({ path, urls, imports } = {}) { | ||
| let mapping; | ||
| return async function resolve(id) { | ||
| if (!mapping) { | ||
| mapping = await getImportMap({ path, urls, imports }); | ||
| } | ||
| // Webpcak interop | ||
| const url = id.replace(/^~/, ''); | ||
| if (mapping.has(url)) { | ||
| return mapping.get(url); | ||
| } | ||
| return url; | ||
| }; | ||
| function filter(url) { | ||
| return !mapping.has(url); | ||
| } | ||
| exports.createPostcssImportResolver = createPostcssImportResolver; | ||
| exports.default = plugin; | ||
| exports.filter = filter; |
+1
-1
| { | ||
| "name": "@eik/postcss-import-map", | ||
| "version": "1.2.0", | ||
| "version": "1.2.1", | ||
| "description": "PostCSS plugin that uses Eik defined import map files to transform bare import specifiers to absolute URLs in @import rules", | ||
@@ -5,0 +5,0 @@ "main": "dist/plugin.js", |
+7
-17
@@ -77,2 +77,6 @@ /* eslint-disable no-restricted-syntax, no-shadow */ | ||
| // The resolve option in postcss-import doesn't support async functions or promises, | ||
| // thus we have to workaround it | ||
| let mapping = new Map(); | ||
| export default postcss.plugin( | ||
@@ -83,3 +87,3 @@ '@eik/postcss-import-map', | ||
| return async (root) => { | ||
| const mapping = await getImportMap({ path, urls, imports }); | ||
| mapping = await getImportMap({ path, urls, imports }); | ||
| root.walkAtRules('import', (decl) => { | ||
@@ -110,18 +114,4 @@ let key; | ||
| // Useful for integrating with other plugins such as postcss-import | ||
| export function createPostcssImportResolver({ path, urls, imports } = {}) { | ||
| let mapping; | ||
| return async function resolve(id) { | ||
| if (!mapping) { | ||
| mapping = await getImportMap({ path, urls, imports }); | ||
| } | ||
| // Webpcak interop | ||
| const url = id.replace(/^~/, ''); | ||
| if (mapping.has(url)) { | ||
| return mapping.get(url); | ||
| } | ||
| return url; | ||
| }; | ||
| export function filter(url) { | ||
| return !mapping.has(url); | ||
| } |
14952
-1.38%204
-7.27%