@pi-r/postcss 0.9.3 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +8 -1
- package/package.json +5 -3
package/index.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const path = require("node:path");
|
|
3
|
+
const autoprefixer = require("autoprefixer");
|
|
4
|
+
const cssImport = require("postcss-import");
|
|
3
5
|
const util_1 = require("@e-mc/document/util");
|
|
6
|
+
const PLUGIN_MAP = Object.freeze({
|
|
7
|
+
'autoprefixer': autoprefixer,
|
|
8
|
+
'import': cssImport,
|
|
9
|
+
'postcss-import': cssImport
|
|
10
|
+
});
|
|
4
11
|
async function transform(context, value, options) {
|
|
5
12
|
context = options.upgrade(context, __dirname);
|
|
6
13
|
const { sourceFile, sourceMap, external } = options;
|
|
@@ -33,7 +40,7 @@ async function transform(context, value, options) {
|
|
|
33
40
|
if (Array.isArray(plugins)) {
|
|
34
41
|
delete baseConfig.plugins;
|
|
35
42
|
Object.assign(baseConfig, { from: targetFile, to: targetFile });
|
|
36
|
-
const result = await context((0, util_1.loadPlugins)(plugins)).process(value, baseConfig);
|
|
43
|
+
const result = await context((0, util_1.loadPlugins)(plugins, PLUGIN_MAP)).process(value, baseConfig);
|
|
37
44
|
if (result) {
|
|
38
45
|
if (result.map) {
|
|
39
46
|
sourceMap.nextMap('postcss', result.css, result.map.toJSON());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/postcss",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "PostCSS transform function for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"homepage": "https://github.com/anpham6/pi-r#readme",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@e-mc/document": "^0.
|
|
23
|
-
"
|
|
22
|
+
"@e-mc/document": "^0.12.0",
|
|
23
|
+
"autoprefixer": "*",
|
|
24
|
+
"postcss": "^8.5.2",
|
|
25
|
+
"postcss-import": "*"
|
|
24
26
|
}
|
|
25
27
|
}
|